Surviving the upgrade to Dart 3.5.0

Bryan Oltman

Founding Engineer


One of the big features of Flutter 3.24.0 is an upgrade to Dart 3.5.0, which comes with a whole bunch of nice changes. Unfortunately, like all software releases, it also came with some bugs.

We encountered some bugs when upgrading our projects at Shorebird and have listed the problems and workarounds we found here:

../.pub-cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart:32:9: Error: Type ‘UnmodifiableUint8ListView’ not found.

We were not alone in seeing this issue. Fortunately, the fix is fairly straightforward:

flutter pub cache clean
flutter pub upgrade

If you track your pubspec.lock file in source control (tip: you should!), you should see that the win32 dependency has been upgraded, and you should now be able to build.

None of your analysis warnings show up in Visual Studio Code.

If:

  1. Your pubspec.yaml file is not at the root of your repo (or “workspace”)
  2. Your analysis_options.yaml file uses an “import” to pull in rules from another file (the default Flutter and Dart templates include package:lints or package:flutter_lints).

This can be worked around by adding a pubspec.yaml at the root of your checkout/workspace. This is what we’ve used:

# This file is a workaround for https://github.com/dart-lang/sdk/issues/56047
name: your_project_name_here
environment:
  sdk: ^3.5.0
dev_dependencies:
  very_good_analysis: ^6.0.0

The above example uses very_good_analysis (which is the lints package we use at Shorebird), but you can easily change the above to use package:lints or package:flutter_lints or whatever analysis imports you depend on.

You can test that this is working by introducing an error in one of your packages not at the root of your repo and you should once again see that error in the “Problems” tab of Visual Studio Code.

Conclusion

Did you have trouble with Dart 3.5.0? Did we miss something? We’d love to hear from you. Reach out via email or Discord anytime.

Shorebird Code Push allows you update your Flutter apps instantly, over the air. It takes less than 5 minutes to integrate and complies with Apple and Google store policies.Get Started With Shorebird