Questions tagged [dart-null-safety]

Tag for questions regarding Dart code involving non-nullable types. This should only be used in combination with the Dart tag.

With the announcement of null safety, there are two types of Dart code:

  • Code with only nullable types.
  • Code with null safety enabled → with non-nullable types.

The tag covers questions involving the latter. Question with this tag should be subset of .

1185 questions
0
votes
3 answers

I have one issue from migrating my flutter app to null_safety

I migrated my application to null-safety. I had some errors and was able to fix all but one last one. This page is a calendar page and the part where the error occurs is when I am building the calendar. I am using the table_calendar plugin. I added…
LostTexan
  • 431
  • 5
  • 18
0
votes
1 answer

Non-nullable instance field '_selectedSize' must be initialized

I have been working with my Store App, but this null safety is getting me pissed now. I have created a class but it gives me this error with later doesn't allow my app to work correctly this is the the product.dart file: import…
0
votes
1 answer

flutter 2.2 update code stopped working and no emulator in some projects

I formatted my laptop lately and all projects stopped, in the main method the first class, I have these errors class MyApp extends StatefulWidget { static void setLocale(BuildContext context, Locale locale) { _MyAppState state =…
Husamuldeen
  • 439
  • 1
  • 8
  • 21
0
votes
2 answers

Cannot run with sound null safety because dependencies doesnot support null safety

I faced the problem when I was using random_string generator dependency for my project and its released version didn't support null safety. So I switched to it's prerelease version implementing null safety and that solved the problem.
SAch
  • 69
  • 8
0
votes
1 answer

Unsound null safety without upgrading legacy packages

My app has a lot of legacy library (e.g. EPUB, EPUB_KITTY) which does not support Null Safety yet and the authors are already inactive. I've read that we can mix non null safe library and null safe library by adding // @dart=2.9 at the main or…
Marc Quebrar Tan
  • 497
  • 2
  • 6
  • 19
0
votes
1 answer

Getting an error "Null check operator used on a null value" when trying to consume value from provider

I'm getting the below error when trying to execute my flutter app: ======== Exception caught by widgets library ======================================================= The following _CastError was thrown building VerifyEmail(dirty, dependencies:…
0
votes
0 answers

cant store user info locally with shared preferences and local storage

This code is from my local storage data file and from my testing i guess the bug is laying in the setUser method or somewhere in the next file. class LocalStorageData extends GetxController{ static const CACHED_USER_DATA = 'CACHED_USER_DATA'; …
0
votes
1 answer

unable to fetch data from firestore in flutter with null safety enabled

I'm trying to make a simple flutter application connected with cloud_firestore. I'm using the null safety enabled versions. I did according to the documentation example. But i got the error while compiling and executing the code. Below is my…
Thiluxan
  • 177
  • 4
  • 13
0
votes
2 answers

The following packages don't support null safety

How to run with the null safety using the following packages package:sqflite package:sqflite_common package:synchronized Code: void database() async { // ignore: unused_local_variable var database = await openDatabase('alimaher.db', version: 1, …
0
votes
0 answers

LateInitializationError: Field 'roast' has not been initialized

I am trying to build a flutter application to randomly select between specific hardcoded "roast" values, and to add them to a listtile located in a card. I have three variables that aren't located in any classes, just so I can access them throughout…
bigman1234
  • 105
  • 2
  • 12
0
votes
0 answers

I did null safety migration on my flutter poject but it show language vesion error

I created an recipe app on flutter i got some error build function return null so i do null safety but thats also shows an error like this Null safety features are disabled for this library. Try removing the package language version or setting the…
Dani
  • 1
  • 2
0
votes
1 answer

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

I am new to flutter and I got this error when I tried to run the flutter run command. I found many articles related to this issue and got to know that flutter run --no-sound-null-safety is the solution to this issue during development. But my…
Paras Bansal
  • 93
  • 1
  • 7
0
votes
1 answer

Flutter/Dart Null Safety Migration

I am trying to migrate my Flutter/Dart project to use null safety. I have updated all of my dependencies and changed the sdk to use ">=2.12.0 <3.0.0". However, when I try to use the migration tool I get the following error: When I look at my…
mac
  • 485
  • 1
  • 6
  • 29
0
votes
2 answers

Flutter null-safety conditionals in object methods

I'm just working through this whole null-safety mode with my Flutter project and unsure what the difference is with ? and ! in calls to object methods. For example, the hint was to add a ! conditional. Here's an example I have right now, and I'm…
gregthegeek
  • 1,353
  • 3
  • 14
  • 24
0
votes
1 answer

Using a List in Flutters null safety is confusing me

I'm trying to migrate an existing, small Flutter app to Flutter 2.12. The null safety thing is new and still confusing to me. For the most part I have been successful in resolving the errors from the migration, but I haven't found a solution for…
Kaptkaos
  • 32
  • 7