Questions tagged [null-safety]
96 questions
0
votes
0 answers
Dart > For (var textResp in perguntas[_perguntaSelecionada]['resposta'] ??) { } Expected an identifier
Im looking for some fix, but cant find. At my For, on final of ')' dart says that
Expected an identifier.
'
for(var textoResp in perguntas[_perguntaSelecionada]['texto'] ??) {
print(textoResp);
}
'
Right on this.
main() { runApp(const…
0
votes
1 answer
The following _CastError was thrown building Builder: Null check operator used on a null value
I suddenly encountered this error while doing cloud firestore operations. Even when I undo my actions, I couldn't resolve the error. I don't know exactly what caused it. I look forward to your support in this matter.
main.dart
Debug Console
═══════…

avcismail
- 31
- 6
0
votes
1 answer
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:
The property 'myDateTime' can't be unconditionally…
0
votes
2 answers
Stateless widget to Stateful widget convert Dart Flutter
This is my code :
class StocksDetailScreen extends StatelessWidget {
final String degisimoran;
final String? sondeger;
final String? hacim;
final String? mindeger;
final String maxdeger;
final String? zaman;
final String?…

Taady
- 2,409
- 2
- 10
- 24
0
votes
3 answers
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) => EconomylistXml.fromJson(json.decode(str));
String…

Taady
- 2,409
- 2
- 10
- 24
0
votes
2 answers
type 'String' is not a subtype of type 'Map' flutter
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
0
votes
1 answer
error: Non-nullable instance field 'reverseMap' must be initialized. Flutter
I'm using a service to create api from xml. I created model file from response. My model file is:
// To parse this JSON data, do
//
// final economylistXml = economylistXmlFromJson(jsonString);
import 'dart:convert';
EconomylistXml…

Taady
- 2,409
- 2
- 10
- 24
0
votes
2 answers
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 str) =>…

Taady
- 2,409
- 2
- 10
- 24
0
votes
1 answer
Class '_InternalLinkedHashMap' has no instance getter 'name'. Receiver: _LinkedHashMap len:7 Tried calling: name Flutter
im trying to call an api.
This is model :
// To parse this JSON data, do
//
// final economylist = economylistFromJson(jsonString);
import 'dart:convert';
Economylist economylistFromJson(String str) =>…

Taady
- 2,409
- 2
- 10
- 24
0
votes
1 answer
Class '_InternalLinkedHashMap' 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 str) => Hisselist.fromJson(json.decode(str));
String…

Taady
- 2,409
- 2
- 10
- 24
0
votes
3 answers
type 'String' is not a subtype of type 'double' in type cast flutter
I'm trying to call an API. This is my model file:
// To parse this JSON data do
//
// final hisselist = hisselistFromJson(jsonString);
import 'dart:convert';
Hisselist hisselistFromJson(String str) =>…

Taady
- 2,409
- 2
- 10
- 24
0
votes
3 answers
Null safety error on model file from quicktype model
Hello this is my modal from quicktype:
// To parse this JSON data, do
//
// final hissedetay = hissedetayFromJson(jsonString);
import 'dart:convert';
Hissedetay hissedetayFromJson(String str) => Hissedetay.fromJson(json.decode(str));
String…

Taady
- 2,409
- 2
- 10
- 24
0
votes
2 answers
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? prefix,
@required String? label,
VoidCallback?…

basel elazaly
- 39
- 1
- 5
0
votes
1 answer
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 calculator and added it to main projects pubspec.yaml…

JabidHasan
- 11
- 1
0
votes
2 answers
Kotlin safe calls(.?) vs null chekcs(!!)
Hi guys I was doing a little bit of reading and playing around with the kotlin language. I still can't figure out why would anybody use null checks over safe calls?
Safe calls would just return a null value if the value is null, this won't crash…

Theprogrammingnoob
- 117
- 8