Home > Net >  Flutter: null safety updates get me some errors in code
Flutter: null safety updates get me some errors in code

Time:09-26

I have a project was made before null safety, now the code has a lot of errors I was fixed all error except this two errors shown below, and I'm not sure what should I do about this

The first error: The first error:

===============================

The Second error: The Second error

Thanks in advance

CodePudding user response:

You can use a null-able value like String? _token. Because it can be a null value before initializing the value.
Or you can use a late keyword to init later, but you shouldn't use this before init.

For more info, reference the Null safety in Dart video.

  • Related