99 questions
0
votes
2
answers
61
views
How to write a generic function that returns nullable only when it gets a nullable in Dart
The following function is an example that represents a more complex situation that can not be simplified:
String? intToString(int? i) {
if (i == null) return null;
return i.toString();
}
Can this ...
-1
votes
4
answers
102
views
Why are we not adding Safe Call Operator(?.) instead of Not-Null Assertion(!!) in OkHttp Library Cache Interceptor?
Why are we not adding Safe Call Operator(?.) instead of Not-Null Assertion(!!) in the attached code in Cache Interceptor ? The source code is : https://github.com/square/okhttp/blob/...
-1
votes
1
answer
94
views
how to migrate flutter mid-level existing project null safety?
I am trying to upgrade my existing Flutter project to null-safety.
When I upgrade the Flutter version to the latest one, as expected it gives thousands of errors due to null safety.
What is the best ...
0
votes
1
answer
54
views
Null check operator used on a null value error on login form
════════ Exception caught by gesture ═══════════════════════════════════════════
Null check operator used on a null value
═══════════════════════════════════════════════════════════════════════════════...
1
vote
1
answer
272
views
Handling Null Safety Error When Accessing 'state' in Flutter Riverpod
I'm integrating Riverpod for state management in a Flutter application and have encountered a null safety error related to accessing the 'state' property. This issue arises within my code that aims to ...
0
votes
0
answers
504
views
how to resolve Error: Library doesn't support null safety. // @dart = 2.9
The language version must be >=2.12.0. error in flutter
I am receiving the following error in the line // @dart=2.9
My dart version is 3.0.3
I am receiving this error due to which my application ...
0
votes
1
answer
35
views
Dart variable is clearly not null but Dart thinks it can be potentially null [duplicate]
Why does Dart say the _parent variable is potentially null when there is a trivial if..then checking? How to get past this problem?
class Scope {
late final Map _map;
Scope? _parent;
...
-1
votes
1
answer
176
views
type 'Null' is not a subtype of type 'num' of 'other'
I'm developing a multiplayer sentence game using Flutter and ran into a problem with handling dynamic data coming from a server. Specifically, I'm encountering a TypeError related to null safety in ...
1
vote
1
answer
241
views
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 ...
0
votes
1
answer
216
views
The parameter 'abc' can't have a value of 'null' because of its type, but the implicit default value is 'null'
@required to a property gave such ERROR:
The parameter 'lng' can't have a value of 'null' because of its type, but the implicit default value is 'null'. (Documentation)
but removing @, removes the ...
0
votes
1
answer
59
views
Flutter/Dart - Difference between obj!.property and obj?.property
In Flutter/Dart their is the null safety feature. In my scenario, I have null safety ON and I am trying to get the property 'myDateTime' of my object MyDateTime . But the compiler produce the error:
...
0
votes
3
answers
56
views
Listview api white screen return problem flutter
this is my model:
// To parse this JSON data, do
//
// final economylistXml = economylistXmlFromJson(jsonString);
import 'dart:convert';
EconomylistXml economylistXmlFromJson(String str) =&...
1
vote
4
answers
602
views
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';
...
0
votes
2
answers
4k
views
NoSuchMethodError: Class 'String' has no instance method 'toDouble'. flutter
I'm trying to call an API.
This is my model :
// To parse this JSON data, do
//
// final hisselist = hisselistFromJson(jsonString);
import 'dart:convert';
Hisselist hisselistFromJson(String ...
0
votes
1
answer
3k
views
Class '_InternalLinkedHashMap<String, dynamic>' has no instance getter 'code' flutter
im trying to call an api. This is my model;
// To parse this JSON data, do
//
// final hisselist = hisselistFromJson(jsonString);
import 'dart:convert';
Hisselist hisselistFromJson(String ...
-1
votes
1
answer
262
views
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 ...
0
votes
2
answers
368
views
3 errors in make components in flutter
I have 3 errors
I tried all possible solutions
look at this
Widget defaultFormField ({
@required TextEditingController? controller,
@required TextInputType? keyboardType,
@required IconData? ...
0
votes
1
answer
115
views
Cannot build dart project due to custom dependencies doesn't support sound null safety
I have been studying over dart projects and tesing dart packages and interdependencies.
I created a Dart Project called console_full_project, where within the project i made a package called ...
0
votes
1
answer
408
views
How to fix "Cannot run with sound null safety" error in Flutter?
I'm encountering the following error in my Flutter project (Android Studio):
Error: Cannot run with sound null safety, because the following dependencies don't support null safety:
* package:fl_chart
...
0
votes
4
answers
1k
views
How to take integer input from user in dart
i am new in dart and just want to know how to take integer input from user in dart with null safety. i found out a way to take number input from dart which is:
String? chossenNumber = stdin. ...
0
votes
1
answer
67
views
Is there a way in PHP to use null coalesing/nullsafe operators to default to not set any value?
I only see use cases were null coalesing can be used to chain values, but not to omit any value.
Am I missing something essential or is there really no shorthand way to write this:
$model->name = &...
0
votes
2
answers
273
views
The argument type 'List<Slots?>?' can't be assigned to the parameter type 'List<Slots>?'
i have recently migrated my code to null safety. got the below error in dart migrate command.
The argument type 'List<Slots?>?' can't be assigned to the parameter type 'List?' at lib/...
1
vote
2
answers
11k
views
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
...
1
vote
2
answers
116
views
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 ...
0
votes
1
answer
543
views
Null aware assignment of map entry
Is there an elegant way to write the following statement for a map?
String? img = json['image'];
if (img != null) {
json['image'] = 'https://example.com/ingredients_100x100/' + img;
}
...