Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Null safety seems enabled when running flutter test --target chrome #74898

Closed
Labels
P3Issues that are less important to the Flutter projecta: null-safetySupport for Dart's null safety featurea: tests"flutter test", flutter_test, or one of our testsfound in release: 1.25Found to occur in 1.25has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: solvedIssue is closed as solvedteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform team
@woprandi

Description

@woprandi

Steps to Reproduce

The null safety feature seems enabled when running flutter test --target chrome

Example with this test :

classUser {String name;}voidmain() {testWidgets('basic', (WidgetTester tester)async {// Build our app and trigger a frame.await tester.pumpWidget(MyApp());expect(find.byWidgetPredicate((widget) {return widgetisDropdownButton<User>&& widget.value.name=="foo";    }), findsNothing);  });}

Expected results:

null safety not enabled if not enabled in the project

Actual results:

enabled when trying to run tests on chrome, works on dart VM

$ flutter test                  00:10 +0: Counter increments smoke test                                                                                                                                                                                                      00:11 +1: All tests passed!$ flutter test --platform chrome        org-dartlang-app:///widget_test.dart:22:61: Error: Property 'name' cannot be accessed on 'User?' because it is potentially null. - 'User' is from 'org-dartlang-app:///widget_test.dart'.Try accessing using ?. instead.      return widget is DropdownButton<User> && widget.value.name == "foo";                                                            ^^^^org-dartlang-app:///widget_test.dart:13:10: Error: Field 'name' should be initialized because its type 'String' doesn't allow null.  String name;         ^^^^Failed to compile
flutter analyzeAnalyzing flutter_playground...                                         No issues found! (ran in 2.2s)
flutter doctor -v[✓] Flutter (Channel beta, 1.25.0-8.3.pre, on Linux, locale fr_FR.UTF-8)    • Flutter version 1.25.0-8.3.pre at /home/william/Documents/flutter    • Framework revision 5d36f2e7f5 (il y a 2 semaines), 2021-01-14 15:57:49 -0800    • Engine revision 7a8f8ca02c    • Dart version 2.12.0 (build 2.12.0-133.7.beta)[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)    • Android SDK at /home/william/Android/Sdk    • Platform android-30, build-tools 30.0.2    • Java binary at: /usr/bin/java    • Java version OpenJDK Runtime Environment 18.9 (build 11.0.9.1+11)    ✗ Android license status unknown.      Run `flutter doctor --android-licenses` to accept the SDK licenses.      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.[✓] Chrome - develop for the web    • Chrome at google-chrome[!] Android Studio (not installed)    • Android Studio not found; download from https://developer.android.com/studio/index.html      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).[✓] VS Code (version 1.52.1)    • VS Code at /usr/share/code    • Flutter extension can be installed from:      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter[✓] Connected device (1 available)    • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.96! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: null-safetySupport for Dart's null safety featurea: tests"flutter test", flutter_test, or one of our testsfound in release: 1.25Found to occur in 1.25has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: solvedIssue is closed as solvedteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp