Skip to content

Exception: NoSuchMethodError: The method 'pathFromUri' was called on null. #530

Open
@ncb000gt

Description

@ncb000gt

I'm running into issues running flutter test- sometimes it's successful and other times it's not. I'm wondering if anyone has any ideas as to whether this is an issue on my end or not. Thanks.


This is an example of the output.

Shell: [ERROR:flutter/shell/testing/tester_main.cc(302)] Unhandled exception
Shell: Exception: NoSuchMethodError: The method 'pathFromUri' was called on null.
Shell: Receiver: null
Shell: Tried calling: pathFromUri(Instance of '_SimpleUri')
Shell: Stack trace: #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
Shell: dart-lang/core#489      Context.fromUri (package:path/src/context.dart:1006:19)
Shell: dart-lang/core#490      Context.prettyUri (package:path/src/context.dart:1068:28)
Shell: dart-lang/core#491      prettyUri (package:path/path.dart:458:34)
Shell: dart-lang/core#492      Frame.library (package:stack_trace/src/frame.dart:105:12)
Shell: dart-lang/core#493      Frame.location (package:stack_trace/src/frame.dart:119:14)
Shell: dart-lang/core#494      Chain.toString.<anonymous closure>.<anonymous closure> (package:stack_trace/src/chain.dart:256:33)
Shell: dart-lang/core#495      MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
Shell: dart-lang/core#496      ListIterable.fold (dart:_internal/iterable.dart:195:30)
Shell: dart-lang/core#497      Chain.toString.<anonymous closure> (package:stack_trace/src/chain.dart:257:12)
Shell: dart-lang/core#498     MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
Shell: dart-lang/core#499     ListIterable.fold (dart:_internal/iterable.dart:195:30)
Shell: dart-lang/core#500     Chain.toString (package:stack_trace/src/chain.dart:258:8)
Shell: dart-lang/core#501     LazyChain.toString (package:stack_trace/src/lazy_chain.dart:32:31)
Shell: dart-lang/core#502     RemoteException.serialize (package:test_api/src/util/remote_exception.dart:51:48)
Shell: dart-lang/path#15     RemoteListener._sendError (package:test_api/src/remote_listener.dart:158:32)
Shell: dart-lang/path#16     RemoteListener.start.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/remote_listener.dart:130:11)
Shell: dart-lang/path#17     _rootRunBinary (dart:async/zone.dart:1222:13)
Shell: dart-lang/core#503     _CustomZone.runBinary (dart:async/zone.dart:1107:19)
Shell: dart-lang/core#504     runZonedGuarded.<anonymous closure> (dart:async/zone.dart:1601:18)
Shell: dart-lang/path#20     _CustomZone.handleUncaughtError (dart:async/zone.dart:1076:19)
Shell: dart-lang/path#21     Future._propagateToListeners (dart:async/future_impl.dart:610:16)
Shell: dart-lang/core#505     Future._completeError (dart:async/future_impl.dart:537:5)
Shell: dart-lang/core#506     Future._asyncCompleteError.<anonymous closure> (dart:async/future_impl.dart:593:7)
Shell: dart-lang/core#507     _rootRun (dart:async/zone.dart:1190:13)
Shell: dart-lang/path#25     _CustomZone.run (dart:async/zone.dart:1093:19)
Shell: dart-lang/path#26     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
Shell: dart-lang/core#508     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
Shell: dart-lang/core#509     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
Shell: dart-lang/path#29     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
Shell:

I have put some logging in place and noticed that style is sometimes null during the execution, but not always which you can see below:
style.pathFromUri(_parseUri(uri))

flutter test test/integration-tests

00:02 +0: loading <path>/test/integration-tests/ui/apps/forgot_password_test.dart                                                                                                                                                                                         
STYLE: posix
00:03 +0: loading <path>/test/integration-tests/ui/apps/settings_test.dart                                                                                                                                                                                                
STYLE: posix
Shell: STYLE: null
Shell: [ERROR:flutter/shell/testing/tester_main.cc(302)] Unhandled exception
Shell: Exception: NoSuchMethodError: The method 'pathFromUri' was called on null.
Shell: Receiver: null
Shell: Tried calling: pathFromUri(Instance of '_SimpleUri')
Shell: Stack trace: #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
Shell: dart-lang/core#489      Context.fromUri (package:path/src/context.dart:1006:19)
Shell: dart-lang/core#490      Context.prettyUri (package:path/src/context.dart:1068:28)
Shell: dart-lang/core#491      prettyUri (package:path/path.dart:458:34)
Shell: dart-lang/core#492      Frame.library (package:stack_trace/src/frame.dart:105:12)
Shell: dart-lang/core#493      Frame.location (package:stack_trace/src/frame.dart:119:14)
Shell: dart-lang/core#494      Chain.toString.<anonymous closure>.<anonymous closure> (package:stack_trace/src/chain.dart:256:33)
Shell: dart-lang/core#495      MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
Shell: dart-lang/core#496      ListIterable.fold (dart:_internal/iterable.dart:195:30)
Shell: dart-lang/core#497      Chain.toString.<anonymous closure> (package:stack_trace/src/chain.dart:257:12)
Shell: dart-lang/core#498     MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
Shell: dart-lang/core#499     ListIterable.fold (dart:_internal/iterable.dart:195:30)
Shell: dart-lang/core#500     Chain.toString (package:stack_trace/src/chain.dart:258:8)
Shell: dart-lang/core#501     LazyChain.toString (package:stack_trace/src/lazy_chain.dart:32:31)
Shell: dart-lang/core#502     RemoteException.serialize (package:test_api/src/util/remote_exception.dart:51:48)
Shell: dart-lang/path#15     RemoteListener._sendError (package:test_api/src/remote_listener.dart:158:32)
Shell: dart-lang/path#16     RemoteListener.start.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/remote_listener.dart:130:11)
Shell: dart-lang/path#17     _rootRunBinary (dart:async/zone.dart:1222:13)
Shell: dart-lang/core#503     _CustomZone.runBinary (dart:async/zone.dart:1107:19)
Shell: dart-lang/core#504     runZonedGuarded.<anonymous closure> (dart:async/zone.dart:1601:18)
Shell: dart-lang/path#20     _CustomZone.handleUncaughtError (dart:async/zone.dart:1076:19)
Shell: dart-lang/path#21     Future._propagateToListeners (dart:async/future_impl.dart:610:16)
Shell: dart-lang/core#505     Future._completeError (dart:async/future_impl.dart:537:5)
Shell: dart-lang/core#506     Future._asyncCompleteError.<anonymous closure> (dart:async/future_impl.dart:593:7)
Shell: dart-lang/core#507     _rootRun (dart:async/zone.dart:1190:13)
Shell: dart-lang/path#25     _CustomZone.run (dart:async/zone.dart:1093:19)
Shell: dart-lang/path#26     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
Shell: dart-lang/core#508     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
Shell: dart-lang/core#509     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
Shell: dart-lang/path#29     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
Shell: 

Some additional info:
flutter doctor -v

flutter doctor -v
[✓] Flutter (Channel stable, 1.22.5, on macOS 11.1 20C69 darwin-x64, locale en-US)
    • Flutter version 1.22.5 at /Users/nick/Code/flutter
    • Framework revision 7891006299 (3 weeks ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/nick/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.9.3

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.52.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.18.0

 
[!] Connected device                          
    ! No devices available

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions