Questions tagged [null-safety]

96 questions
0
votes
1 answer

Closure call with mismatched arguments: function 'LoginScreen.build.'

Hello I'm getting this error when I tried to run the code Here is the full error: ======== Exception caught by widgets library ======================================================= The following NoSuchMethodError was thrown building…
0
votes
1 answer

Error: The parameter 'onSubmit' can't have a value

Hi I have created a default form field, in a separate dart file called components, and I have login_screen.dart also. there are many errors I don't know how to fix it, and make the code work, I will put down the code of the component.dart code: …
0
votes
0 answers

pub get failed when upgrading the flutter version

I have upgraded the flutter version to the latest (2.5.2). when I upgrade, some dependencies also upgraded. but some of them are not compatible with null-safe. SDK version is (2.5.2), sdk: ">=2.12.0 <3.0.0" suggest versions (only incompatible…
Tharindu Lakshan
  • 3,995
  • 6
  • 24
  • 44
0
votes
3 answers

How to make a generic functions in List to get a Non-Optional type in Dart - Null Safety

We are migrating our Flutter app into null safety and I've encountered a bunch of missing helpers in order to get rid easily of an optional into a non-optional of the same type. To get you in the context, I would like to have a List
0
votes
1 answer

TMDB_API don't Support null Safty?

I am making a movie app using tmdb_api. I added package to pubspce.yml and did pubget. Of course it was added as normal. dependencies: flutter: sdk: flutter tmdb_api: ^1.2.7 google_fonts: ^2.1.0 I connected the api key and token in…
Jungwon
  • 1,038
  • 7
  • 20
0
votes
0 answers

Modify automatically generated properties from .net core Entity Framework Scaffold

Our goal To be able to use a tool that generates automatically all the models from our DB (MySQL) with Null Safety enabled (Nullable Reference Types) and that lets us modify some properties' types and values without losing all the advantages from…
0
votes
1 answer

Is it good to create new object if pointer is null just to get its fields or not?

Is it good to write like this? UserInfo myMethod(User user) { user = Optional.ofNullable(user).orElse(new User())? String name = user.getName() String type = user.getType(); return new UserInfo(name, type); } Or better use…
Alexander.Iljushkin
  • 4,519
  • 7
  • 29
  • 46
0
votes
1 answer

Unable to run flutter mobile app due to null checker issue

I'm trying to connect firebase to my flutter app. All the features are working fine, when running as a web app. But when I'm trying to run the mobile app, the app isn't running and showing an error message as below in the terminal. E/flutter (…
Thiluxan
  • 177
  • 4
  • 13
0
votes
1 answer

How to return in animatedbuilder with null-safety?

can anyone help me with this i am learning how to make carousel from techie blossom channel playlist Error is below in the screen shot I am struggling with null safety thing can anyone resolve this problem. İ tried with null-safety but couldn't…
Rahil Ansari
  • 43
  • 10
0
votes
0 answers

dart nullability checking method

I have a method bool isNotEmpty(dynamic e), where i check nullability myself based on few criteria (e.toString() == null.toString(), e.length for String's and List's, etc.). my question is, I have a piece of code like this: String e = 'a'; if…
Adnan
  • 906
  • 13
  • 30
0
votes
2 answers

Get a stream of documents from Firebase with Flutter in Null-safe way

I'm a flutter null-safe noob. I used the code below, but I am getting this error: The argument type 'Map?' can't be assigned to the parameter type 'Map' This does seem like a null-safe issue but then again it may…
Chris Laurie
  • 33
  • 1
  • 5
-1
votes
1 answer

The argument type 'Null' can't be assigned to the parameter type 'ClassPenangkap'.can anyone help me?

import 'package:flutter/material.dart'; import 'dart:async'; import 'crud.dart'; import 'class_penangkap.dart'; import 'acces_database.dart'; import 'enter.dart'; class Home extends StatefulWidget { …
-1
votes
1 answer

Error on Flutter widget build function with null safety

I've created a class with 2 arguments, and 'title' is non-nullable and 'leading' is nullable. So I defined two possible cases with if statement, for when 'leading' is null and not null. (I refered this article: Understanding null safety |…
-1
votes
1 answer

Null Safety App not runnable on Flutter 3.0

I've a Flutter app, that was running properly on Flutter 3.0, but after migrating to Null Safety, I receive this while trying to run: FAILURE: Build failed with an exception. * Where: Script…
AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
-1
votes
1 answer

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

I am getting this error... code snippet that is throwing this error: catalog.desc.text.textStyle(context.captionStyle).make(),