Home > Software engineering >  Upgraded to Flutter 3.0 from 2.8.1, getting: Warning: Operand of null-aware operation '?.'
Upgraded to Flutter 3.0 from 2.8.1, getting: Warning: Operand of null-aware operation '?.'

Time:05-14

Upgraded to Flutter 3.0 from 2.8.1, getting: Warning: Operand of null-aware operation '?.' has type 'PaintingBinding' which excludes null error

It's on binding.dart - a file I don't touch at all.

() => PaintingBinding.instance?.imageCache?.evict(key),
                            ^

Any chance you guys know how I can fix it?

Don't know if related, but also seeing this a lot:

Class 'kotlin.Unit' was compiled with an incompatible version

Used the guide here to migrate: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

CodePudding user response:

remove "?" at () => PaintingBinding.instance?.imageCache?.evict(key),

CodePudding user response:

So, something which helped me:

  1. remove the next folder /Users/your-user/.pub-cache/hosted/pub.dartlang.org
  2. hit flutter pub upgrade

and then try to run your project

  • Related