dart-null-safety Questions

11

Solved

I'm trying to create a "copyWith" method for my class, and it works with most scenarios. The problem is when I try to set a nullable property to null, because my function cannot recognize...
Broeker asked 16/6, 2021 at 20:6

5

Solved

when running flutter pub run build_runner build I get this error. Failed to build build_runner:build_runner: ../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib...
Fellmonger asked 23/2, 2022 at 10:18

3

Solved

[INFO] Precompiling build script...... [WARNING] ../../flutter/.pub-cache/hosted/pub.dartlang.org/gql_code_builder-0.2.0/lib/src/ast.dart:618:12: Error: A non-null value must be returned since the ...
Damon asked 22/4, 2022 at 1:20

21

Solved

I want to achieve to make a drawer with different items on it, so I am creating a separate file for the DrawerItems and the with the constructor, pass the data to the main file. But I get the follo...
Lundy asked 22/10, 2020 at 14:11

4

I'm trying to create a Textbutton widget with a disabled property like this: class AppTextButton extends StatelessWidget { final String title; final void Function(BuildContext context) onPress; ...
Warnock asked 31/8, 2021 at 8:12

5

Solved

Question I am using AppLocalizations.of(context).myString to internationalize strings in my null safe flutter app. My IDE tells me that AppLocalizations.of(context) can return null. What's the best...
Huai asked 10/1, 2021 at 19:13

5

Solved

Just started Flutter with native iOS background, so I just have a quick question about Dart beta null safety. So in Swift, because they have the idea of null safety from the beginning just like Kot...
Blida asked 28/1, 2021 at 12:44

3

Solved

I am getting a "nullable expression" error. The problem is occurring in the following lines: left: isSideBarOpenedAsync.data ? 0 : 0, right: isSideBarOpenedAsync.data ? 0 : screenWidth - ...
Alabaster asked 28/5, 2021 at 13:52

3

Solved

I've been trying to debug this error type 'Null' is not a subtype of type 'String' in type cast but could not find the the exact place where the error is being produced besides that it is genereate...
Blodget asked 18/12, 2021 at 4:55

3

Solved

I'm in the process of migrating over a large project to null safety and I'm coming across a strange error I'm not entirely sure how to fix. "Error: Type argument 'T' doesn't conform to the bou...
Ranjiv asked 18/4, 2021 at 6:44

5

Solved

Whenever I try to run a dart tool like Dart Migrate I get the following error and I am unable to run that tool. Is there a way to solve this problem or I have to reinstall Flutter? Btw every thing...
Dejesus asked 13/4, 2021 at 12:0

17

Solved

I have followed "Enabling null safety" on dart.dev and also migrated my whole Flutter application to null safety. Now, I am trying to run it using flutter run. However, it will not start ...
Nashbar asked 19/11, 2020 at 18:23

10

I have a null-safe library and in the example folder I'm using the following import: import 'package:flutter/material.dart'; However, the linter is giving me the following warning: The library 'p...
Grisons asked 29/1, 2021 at 5:0

4

I'm new to flutter and dart and I am trying to make a clone of instagram for studying purposes, but I am getting the error below. Could you help me identify where the code is incorrect? The output ...
Firenew asked 21/7, 2022 at 20:44

8

Solved

I tried to use null safety, but it's giving me this error: This requires the 'non-nullable' language feature to be enabled. Try updating your pubspec.yaml to set the minimum SDK constraint to 2.10...
Leavings asked 31/10, 2020 at 11:9

5

Solved

I don't know what is the problem is / how to fix this while I tring to code it shows this error on the test folder widget_test.dart x testWidgets('Counter increments smoke test', (WidgetTester tes...
Anguine asked 11/10, 2021 at 14:17

5

Solved

The property 'settings' can't be unconditionally accessed because the receiver can be 'null', what to do my code : class DressDetailsScreen extends StatelessWidget { static const routeName = '/Dre...
Farrow asked 23/5, 2021 at 12:20

3

Solved

I am trying to migrate a project into null safety mode,after migrating and clearing all the errors, I am getting this problem named 'Sort pub dependencies.dart(sort_pub_dependencies)'. I searched G...
Ginglymus asked 9/3, 2021 at 10:58

8

Solved

Dart function I have the following Dart function and I am now using null safety: void calculate({int factor}) { // ... } The analyzer complains that: The parameter 'factor' can't have a value of...
Radborne asked 27/10, 2020 at 18:9

3

Solved

i'm new at dart. I don't know what kind of mistake i have made, but this code didn't work. Is a simple code, just read the age in terminal and say it's underage or over 18. import 'dart:io'; main...
Caren asked 18/3, 2021 at 16:40

4

Solved

I changed my SDK version for flutter to min , so that I can fix my code for null safety. There is one issue that I don't understand, this line produces the following error: The argument type 'Color...
Attorneyatlaw asked 19/3, 2021 at 10:11

4

I'm new to Flutter. I am trying to develop an application. I want to show the staff list in the Firebase database. However, I am getting the following error. Error : The method '[]' can't be uncon...

5

Solved

After the release of Flutter 2, I've migrated my code to sdk: '>=2.12.0 <3.0.0' and all codes are "sound null safety" now. But I encountered errors in unit tests with mockito 5.0.0 ...
Master asked 11/3, 2021 at 12:40

2

Suppose there are two models User and City @JsonSerializable() class User { int id; String name; City? city; List<Map<String, City>>? listMapCity; } @JsonSerializable() class City...
Milissa asked 23/5, 2021 at 10:2

3

Im trying to migrate dart null safety but I get the following error when I run dart migrate Bad state: Error: package has unmigrated dependencies. Before migrating your package, we recommend ensur...
Suspense asked 6/10, 2021 at 17:48

© 2022 - 2024 — McMap. All rights reserved.