Search code examples
flutterflameforge2d

Flame 0.29.4 cannot run with sound null safety


When trying to run my Flame application I get the following error:

Error: Cannot run with sound null safety, because the following dependencies don't support null safety:

  • package:flame
  • package:ordered_set
  • package:box2d_flame

I have the following in my pubspec.yaml file:

dependencies:
  flame: ^0.29.4
  flame_box2d: ^0.0.1

Solution

  • Flame 0.29.4 doesn't support null safety, you can use the latest release candidate of version 1.0.0 if you want null safety (it is more stable than 0.29.4 anyways, and all the docs are for that version).

    To use the newest release candidate together with Forge2D, put the following in your pubspec.yaml file:

    dependencies:
      flame: ^1.0.0-releasecandidate.16
      flame_forge2d: ^0.8.2-releasecandidate.15
    

    Do note that box2d_flame has been renamed to flame_forge2d, since the physics engine is now called Forge2D.