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

Flutter - Type 'Null' is not a sub type of string

I'm trying to use Firebase to login, but I'm getting Type 'Null' is not a sub type of string as error when I try to parse _userId = responseData['localId']; When I try to parse _token = responseData['idToken'];, it works…
munsra
  • 9
  • 2
0
votes
3 answers

can someone help me with this Complex json to dart

i get a json response from this link https://itunes.apple.com/in/rss/topalbums/limit=25/json can anyone make a model class where i can so a http get request and use the snapshot data in future builder . I tried quicktype but the model class throwing…
BragU
  • 11
  • 3
0
votes
1 answer

29:52: Error: Property 'photoURL' cannot be accessed on 'User?' because it is potentially null

I am trying to add google sign in with firebase auth in my basic flutter app, but I am getting above mentioned error. I searched alot but couldn't found any answer, please help me out. This is the whole error in my…
0
votes
1 answer

Facing Errors In Flutter When Using Sqflite

import 'package:flutter/material.dart'; import 'package:todoapp/data/data.dart'; import 'package:todoapp/data/task.dart'; class TodoHome extends StatefulWidget {TodoHome({Key? key}) : super(key: key); @override _TodoHomeState createState()…
vinay
  • 115
  • 1
  • 10
0
votes
1 answer

FLUTTER - Problem with List constructor and null safety mode

I would like to use this "Levenshtein" function to assess similarities between two strings (to check if user has committed a spelling mistake). Since I work on null safe mode, it points out an error with the LIST constructor : List> d = …
SylvainJack
  • 1,007
  • 1
  • 8
  • 27
0
votes
1 answer

How can i resolve the Null check operator used on a null value error when reading from Shared Preferences

Can anyone help? I am trying to collect some data from shared preferences but getting a 'Null check operator used on a null value' message on the emulator. I am trying to collect a list of 'Resolutions' from shared preferences within initState when…
0
votes
1 answer

How can i add circular progress indicator on "onPressed" in the follwing code?

child: RaisedButton( color: AppColors.darkGreenColor, onPressed: () async{ passwordController.text == '' ||concatePhoneNumber == '' ? Get.snackbar("Please Enter Mobile or Password",…
Ali Punjabi
  • 452
  • 4
  • 19
0
votes
2 answers

LateInitializationError: Field 'avatar' has not been initialized flutter

Below is how my json looks like { "data": { "id": 2, "email": "floki@mail.com", "first_name": "Valjakudze", "last_name": "shipment", "avatar":…
0
votes
1 answer

How to show network signal strength in dbm in flutter

Just wanted to show the signal strength in dbm in flutter app.
0
votes
1 answer

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

I upgraded my app to Flutter 2 and made all the things null safe. After that, I am encountering an error implementing Google mobile ads SDK. I followed all the documentation and according to that, I am not supposed to get this error although the…
0
votes
0 answers

'String' is not a sub type of type map flutter error

//Hello, I am trying to pass Map as an argument to the new screen but it ends in error with a red screen. here is my code first the class where the Map is defined, I am using firebase for a database with this app. I am trying to make get job app so…
0
votes
1 answer

How onPressed: func is different from onPressed: () => func() in Dart?

I have a class: class Foo { void bar() {} } And I'm using it like this: Widget build() { late Foo foo; return Column( children: [ ElevatedButton( onPressed: foo.bar, // Error: child: Text('Use'), ), …
iDecode
  • 22,623
  • 19
  • 99
  • 186
0
votes
1 answer

Exception Happened: type 'String' is not a subtype of type 'Mode'

I have recently transferred a fully functioning app to dart null safety and it has thrown some errors This API call has been adapted but now I am receiving the error flutter: Exception Happened: type 'String' is not a subtype of type 'Mode' I call…
al246
  • 220
  • 6
  • 16
0
votes
1 answer

gestureEvent or PointerEvent on longPressed DialogBox

How to add tap or longpress (any gestureDector event) on longpressed DialogBox clicking on icons on popop after showing that, can we swipe on icons and getting action like with click? hear i'am, using "OverlyEntery" to show dialog, iam using…
0
votes
1 answer

How to make the scrollcontroller of a TextField follow the current position of the cursor in Flutter?

I am trying to create a custom keyboard so that my application has its own style. I got the device keyboard not showing up but now I am faced with the problem that when I type and the cursor leaves the image the TextField does not follow the cursor…
Hekhy
  • 21
  • 6