Asking for advice building a flutter332 application

Hello all. I am trying to package a flutter app into master and having the devil of a time getting it to work. I’m hoping y’all might have some advice.

The app is Release v0.9.3 · interstellar-app/interstellar · GitHub.

This is the package.nix I have so far: nixpkgs/pkgs/by-name/in/interstellar at jollydev/interstellar-at-0p9p3 · JollyDevelopment/nixpkgs · GitHub

The error I keep getting is during the packageRun build_runner build -d step:

[SEVERE] freezed on lib/src/widgets/content_item/content_item.dart:                                                                                                                             
                                                                                                                                                                                                
This builder requires Dart inputs without syntax errors.                                                                                                                                        
However, package:interstellar/src/widgets/content_item/content_item.dart (or an existing part) contains the following errors.                                                                   
content_item.dart:622:69: This requires the 'null-aware-elements' language feature to be enabled.                                                                                               
content_item.dart:624:39: This requires the 'null-aware-elements' language feature to be enabled.                                                                                               
content_item.dart:649:68: This requires the 'null-aware-elements' language feature to be enabled.                                                                                               
And 6 more...                                                                                                                                                                                   
                                                                                                                                                                                                
Try fixing the errors and re-running the build.                                                                                                                                                 
                                                                                                                                                                                                
package:build_resolvers/src/resolver.dart 244:9  AnalyzerResolver.compilationUnitFor.<fn>                                                                                                       
package:pool/pool.dart 127:28                    Pool.withResource                                                                                                                              
package:source_gen/src/builder.dart 389:18       _hasAnyTopLevelAnnotations                                                                                                                     
package:source_gen/src/builder.dart 97:11        _Builder.build                                                                                                                                 
                                                                                                                                                                                                
[SEVERE] freezed on lib/src/widgets/user_status_icons.dart:                                                                                                                                     
                                                                                                                                                                                                
This builder requires Dart inputs without syntax errors.                                                                                                                                        
However, package:interstellar/src/widgets/user_status_icons.dart (or an existing part) contains the following errors.                                                                           
user_status_icons.dart:61:18: This requires the 'null-aware-elements' language feature to be enabled.                                                                                           
user_status_icons.dart:61:30: This requires the 'null-aware-elements' language feature to be enabled.                                                                                           
                                                                                                                                                                                                
Try fixing the errors and re-running the build.                                                                                                                                                 
                                                                                                                                                                                                
package:build_resolvers/src/resolver.dart 244:9  AnalyzerResolver.compilationUnitFor.<fn>
package:pool/pool.dart 127:28                    Pool.withResource
package:source_gen/src/builder.dart 389:18       _hasAnyTopLevelAnnotations
package:source_gen/src/builder.dart 97:11        _Builder.build

As far as I can tell that error indicates that the dart being used in the build is lower than 3.8.0, which is when the null-aware-elements feature came in. The problem is that the dart inside the build process reports as either 3.8.0-278.4.beta (when building from the nixos-25.05 branch), 3.8.0 (when building from master), or even 3.8.1 when building from the branch in this PR flutter332: 3.32.0 -> 3.32.2 by emaryn · Pull Request #412226 · NixOS/nixpkgs · GitHub.

Things I have tried so far:

  1. just a regular build from a branch off of master with nix-build -A insterstellar
  2. making a temporary directory and creating a nix-shell build env with: nix-shell -E "with import <nixpkgs> {}; callPackage /path/to/nixpkgs/pkgs/by-name/in/interstellar/package.nix {}" then doing the runPhase unpackPhase, runPhase otherPhase as in Nixpkgs/Create and debug packages - NixOS Wiki.
  3. adding the nixpkgs master clone on disc to the NIX_PATH with: export NIX_PATH=masterpkgs=/path/to//nixpkgs:$NIX_PATH and doing the same nix-shell from #2 but with <masterpkgs>
  4. doing the same as #3, but with the branch from the PR mentioned above.

I was able to get the prior version of the app to build using flutter329 here: nixpkgs/pkgs/by-name/in/interstellar at jollydev/interstellar-at-0p9p2 · JollyDevelopment/nixpkgs · GitHub but that version is missing a bunch of features so I did not submit the PR.

I can also do a local build in a nix-shell on my machine for development and that works. But that’s using a buildFHSEnv to make a shell with vscode and extensions and dev dependencies in it so I dont know if that would help. That one is here: nixpkgs/scratch/interstellar_dev_shell.nix at jollydev/interstellar-scratch · JollyDevelopment/nixpkgs · GitHub (please forgive its untidiness, its an evolved-over-time-but-not-optimized kludged together setup.)

Every time I get that null-aware-elements error.

My guess is there is some setting or flag I need to provide that I am just not aware of as I am new(-ish) to both flutter/dart and nixpkgs.

Does anyone have any advice or pointers on what I should try next?

Thanks in advance!

interesting, I had thought that the dart in use in the flutter332.buildFlutterApplication was using its own version of dart.

ie in nixpkgs/pkgs/development/compilers/flutter/versions/3_32/data.json at 637d900e333c7d2c95274a059459f5b4bcb6accd · NixOS/nixpkgs · GitHub they have the 3.8.0 version

and this sets up an override for dart to use their versions for the one inside flutter. nixpkgs/pkgs/development/compilers/flutter/default.nix at 637d900e333c7d2c95274a059459f5b4bcb6accd · NixOS/nixpkgs · GitHub

thats a very complex package though, so I may not have tracked all the code properly to understand what it is doing.

i’ll give this a try, ty

note - adding // @dart=3.8 to the top of the problematic .dart files did indeed get past the error and the app builds.

tyvm @sift !

I will keep an eye on the dart PR you linked and adjust later once that has merged. but this gets me unblocked.