Closed stegrams closed 7 months ago
For now, we wanted to provide flutter run
for web development as well. It's easier to just simply provide a custom web server, but we cannot use Flutter's debug tools in that case. Hope we can find a solution in-between :)
From the next version of Flutter, it seems it would be possible to run Flutter web server with custom HTTP headers without modification. This change is already in the master channel of Flutter, but it's not released yet.
@stegrams , may I ask if rinf wasm --release
produces error? If so, could you share the output here?
Hello @temeddix! Before I comment out the line that resolves links, the error is the following:
Unhandled exception:
PathNotFoundException: Cannot open file, path = '/nix/store/aq3y538nnn0v0fdya9xcnv8nl6flcngn-flutter-wrapped-3.13.8/packages/flutter_tools/lib/src/isolated/devfs_web.dart' (OS Error: No such file or directory, errno = 2)
#0 _checkForErrorResponse (dart:io/common.dart:55:9)
#1 _File.open.<anonymous closure> (dart:io/file_impl.dart:381:7)
<asynchronous suspension>
#2 _File.readAsString (dart:io/file_impl.dart:621:18)
<asynchronous suspension>
#3 _verifyServerHeaders (file:///home/user/.pub-cache/hosted/pub.dev/rinf-5.3.1/bin/rinf.dart:374:27)
<asynchronous suspension>
#4 _buildWebassembly (file:///home/user/.pub-cache/hosted/pub.dev/rinf-5.3.1/bin/rinf.dart:317:3)
<asynchronous suspension>
#5 main (file:///home/user/.pub-cache/hosted/pub.dev/rinf-5.3.1/bin/rinf.dart:29:9)
<asynchronous suspension>
After:
Unhandled exception:
FileSystemException: Cannot open file, path = '/nix/store/3a8nj8xg0g4xna89md5l0isajv5qas8a-flutter-wrapped-3.13.8-sdk-links/packages/flutter_tools/lib/src/isolated/devfs_web.dart' (OS Error: Read-only file system, errno = 30)
#0 _checkForErrorResponse (dart:io/common.dart:55:9)
#1 _File.open.<anonymous closure> (dart:io/file_impl.dart:381:7)
<asynchronous suspension>
#2 _verifyServerHeaders (file:///home/user/.pub-cache/hosted/pub.dev/rinf-5.3.1/bin/rinf.dart:396:3)
<asynchronous suspension>
#3 _buildWebassembly (file:///home/user/.pub-cache/hosted/pub.dev/rinf-5.3.1/bin/rinf.dart:317:3)
<asynchronous suspension>
#4 main (file:///home/user/.pub-cache/hosted/pub.dev/rinf-5.3.1/bin/rinf.dart:29:9)
<asynchronous suspension>
I see. Once Flutter supports custom web server headers(Maybe in version 3.19), I will make that code skippable. For now, there's no way to provide our HTTP server headers if we cannot modify that Flutter file. We could make our own web server, but that would be overengineering :)
For your information, HTTP headers need to be set in order to make some web APIs work.
Sharing the latest status:
Report
NixOS does not allow one package to modify the files of another.
Steps to Reproduce
System Information
rinf 4.20.0
Actually there are 2 issues here since, when Rinf scans for Flutter, it dereferences the link that gets from
which
, but the result path does not contain the target filedevfs_web.dart
(NixOS magic). That was easy, I commented out the dereferencing source line.During the next steps, Rinf creates new content and patches the target file. That's a no-go on NixOS. Files inside packages provide strictly read-only access.
Generally though, I hope there will be a more "rusty" solution than patching code that do not control, because that may lead to undefined behavior.
E.g. a comment that contains the "httpServer = await" may be placed near the end of the file and people will start to report incomprehensible issues on Flutter project.
Thank you for sharing, and I hope to enjoy Rinf on my system one day.