Questions tagged [null-safety]

96 questions
1
vote
1 answer

the property 'uid' cant be unconditionally accessed because the receiver can be null

i am trying to return value in users where i am getting this error if i am trying to fix this error by adding null sign it does not return any value becuase all this value is going to be null and i want to return this value and save it so i can use…
Amazee21
  • 11
  • 2
1
vote
4 answers

type 'Null' is not a subtype of type 'String' flutter on api call

Im using a service to create api from xml. This is my model file: // To parse this JSON data, do // // final economylistXml = economylistXmlFromJson(jsonString); import 'dart:convert'; EconomylistXml economylistXmlFromJson(String str) =>…
Taady
  • 2,409
  • 2
  • 10
  • 24
1
vote
2 answers

The body might complete normally, causing 'null' to be returned, but the return type, 'Future', is a potentially non-nullable type

I upgraded my project to null-safety as they describe here dart migrate. I applied all suggestions but I get an error on one of my screens. How can I fix this? Future systemBackButtonPressed() { if…
Taady
  • 2,409
  • 2
  • 10
  • 24
1
vote
2 answers

Null check operator used on a null value: The relevant error-causing widget was CustomBottomBar

Im new to Flutter. I got this error Null check operator used on a null value error. but I could not solve it. This is the place where the second exception "The relevant error-causing widget was Consumer" occurs: @override Widget…
user13943076
  • 21
  • 1
  • 3
1
vote
2 answers

What is your recommended workflow for Flutter null safety migration tool

I am using the Flutter null safety migration tool. What is your recommended workflow for null safety migration? For example: Start at main.dart first and work your way out from there? Start with models or classes first? Start with screens…
Mavrik00
  • 15
  • 4
1
vote
2 answers

MissingStubError: 'get' when using mockito 5.1.0 to test api using riverpod

I am trying to use mockito to return a fake response in the http.Client call and be able to test the service. I have followed the documentation. It tells me that I should use annotate to generate a fake class, but it seems that the null safe of…
1
vote
1 answer

I have a problem with Null Safety an the problem is 'Null check operator used on a null value'

It happened when getting some data from firebase and decoding them using model, and here is the method: UserModel? userModel; void getUser() { emit(GetUserLoadingsState()); FirebaseFirestore.instance.collection('users').doc(uId).get().then((value)…
1
vote
1 answer

Zero joins with null in the null-safe join

I have noticed that 0 joins with null when using null-safe join (eqNullSafe). df1 = spark.createDataFrame([(1, ), (None, )], ['df1_id']) df2 = spark.createDataFrame([(None, ), (0, )], ['df2_id']) df1.join(df2, df1.df1_id.eqNullSafe(df2.df2_id),…
ZygD
  • 22,092
  • 39
  • 79
  • 102
1
vote
1 answer

Error: Expected ',' before this. validator: validate!(String value),

Hello I'm getting this error in flutter: lib/shared/components/components.dart:41:35: Error: Expected ',' before this. validator: validate!(String value), ^^^^^ lib/modules/login/login_screen.dart:36:33:…
1
vote
1 answer

How not to print a null value received from sqflite database?

I'm making a "Recipes app" to learn. I have this problem now: I'm working with Sqflite and I have a page where I show the ingredients from the recipe, the sql query is OK, but the problem is that I'm getting the null values and I don't know what to…
1
vote
1 answer

GetX page routing returns "Null check operator used on a null value" error

I am trying to do a very simple page routing with GetX using the latest version of Flutter which includes null safety. It keeps returning the error "Null check operator used on a null value" even when I am passing no arguments or referencing any…
Robyn
  • 23
  • 4
1
vote
1 answer

flutter "could not generate 'fromJson' code for Type" error on Nullable

I upgraded my project to Null-Safety but I'm getting an error when I define a property as null when running the build_runner: @JsonKey() late Guid? colonizedStellarObjectId; The type Guid is from here, but I modified it to support…
DirtyNative
  • 2,553
  • 2
  • 33
  • 58
1
vote
0 answers

"Null check operator used on a null value" shown after signing out

I get the following messages after signing out from firebase on my app. *Null check operator used on a null value When the exception was thrown, this was the stack: #0 MainScreenPage.build..
gr_rg
  • 25
  • 4
1
vote
1 answer

Flutter null safety constructor

I am using flutter's latest(null safety) version and I created a constructor. This code does not show anything on the screen. Why can't I see icons and text? import 'package:flutter/material.dart'; import 'input_page.dart'; void main()…
FGY
  • 77
  • 6
1
vote
0 answers

can not debug with flutter null-safety flutter-dependencies

i can run my app only using Flutter run --no-sound-null-safety my mobile attached my my lab top samsung M21 using android studio flutter version Flutter 2.2.1 dart version Dart 2.13.1 on windows 10 my app it is a template i bought it from…