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
2 answers

Dart Null safety error : Null check operator used on a null value

I got this error, i understood it but i don't know how to fix it This error occurs when I try to use the variables of the profilPicker class. class MyDrawerPages extends StatefulWidget { final ValueChanged onSelectedItem; final…
user17310705
0
votes
1 answer

How to create multiple checkbox from API in flutter

I have been able to display JSON data from API in Future-builder. However, the widget has checkbox for each list. Whenever I check on one list, the whole list get checked. I want a help on how to check each list individually and be able to use the…
0
votes
1 answer

How to import and use a function from another dart file in flutter

I am making a app in which I am using package snake bottom navigation and advanced drawer. Both are configured fine in a file but I'm having issue when when I want to use the function on a new page to open and close the drawer. I am unable to import…
0
votes
2 answers

The argument type 'Id?' can't be assigned to the parameter type 'Id'

Don't know how to resolve it. The two lines show error. It should be resolved to run the code. I got error on the two lines where type id and names are converted into "id" and "names". // To parse this JSON data, do // // final welcome =…
0
votes
2 answers

Can someone assist me to update this functional programming error handling example for null safety in Flutter

I'm learning proper error handling, I feel THIS is the best possible method of handling errors I've found. Problem is that the project is old as hell and not updated for null safety. Project works well with old version. Tell me how I can get over…
RobbB
  • 1,214
  • 11
  • 39
0
votes
2 answers

my code not complete for where contact number

How to fix code my code flutter and use plugin filterContacts() { setState(() { List _contacts = []; _contacts.addAll(contacts); if (searchController.text.isNotEmpty) { …
0
votes
1 answer

org-dartlang-debug:synthetic_debug_expression:1:1: Error: Getter not found: &NoSuchMethodError (NoSuchMethodError: The method '[]' was called on null

I'm working on a simple online dictionary mobile app. There were no errors until one-day I decided to search for the word "pick" The app works on API provided by DictionayAPI. The API that gets called when I search for "pick" is this. I created few…
Thebluedragon
  • 2,564
  • 2
  • 4
  • 13
0
votes
2 answers

Method 'showBottomSheet' cannot be called on 'ScaffoldState?' because it is potentially null

Hello I'm getting this error when I tried to run the code lib/layout/home_layout.dart:54:36: Error: Method 'showBottomSheet' cannot be called on 'ScaffoldState?' because it is potentially null. - 'ScaffoldState' is from…
0
votes
2 answers

A value of type 'Object?' can't be assigned to a variable of type 'Tasker?'

Recently updated an existing and working flutter project to null safety but I cannot get my sign-in logic with firebase to work. It fails with the below error A value of type 'Object?' can't be assigned to a variable of type 'Tasker?'. Try changing…
Boss Nass
  • 3,384
  • 9
  • 48
  • 90
0
votes
1 answer

How to Handle "Cannot run with sound null safety" error with Visual Studio AppCenter in Flutter APK Build

I'm trying to add AppCenter to my application but I get build error: Error: Cannot run with sound null safety, because the following dependencies don't support null…
Aurora
  • 422
  • 1
  • 7
  • 21
0
votes
2 answers

Flutter initialization filed

I have done a flutter app with a code where the user can select gender from 2 cards and the GestureDetector the android studio don't give me any error but when I try to test the app I recive this error on device LateInitilizationError: Field…
jonnyf
  • 21
  • 6
0
votes
2 answers

how to migrate snapshot.data.data(); to null safety

this is the code can any help me how to change this to null safety, I am getting errors in .data(). i changed my project to null-safety, and then i am facing this issue this is the error The method 'data' can't be unconditionally invoked because the…
FTF Studio
  • 89
  • 3
  • 17
0
votes
1 answer

How do I solve this error: LateInitializationError: Field 'weatherInfo' has not been initialized?

I'm developing a weather app using an API from OpenWeatherMap. Every time I try to run my code, the error late initialization pops up. I've tried adding the null safety check(!) in place of late but it's still the same. Any idea where I could have…
0
votes
1 answer

I have several expanded widgets in column. First I expand one widget. when I expanding the second one first one should auto collapse

I have implement several no of expanded items using expansion widget. These are the steps All the widgets are collapsed at the beginning First widget was expanded Second widget also expanded without collapse first one I want to automatically…
0
votes
1 answer

(flutter) FutureBuilder passing Map<> as property

I'm trying to learn Flutter from a book that has been written before null safety, the code in it works perfectly if I add // @dart=2.9 at the beginning of the file, but gives some error without. The error: The argument type 'Object?' can't be…