NoSuchMethodError:对null调用吸气剂“ cls”

时间:2019-08-31 05:40:54

标签: flutter

如何解决以下问题?

我正常运行我的应用程序,它运行良好。

但是当我设置了断点后,然后尝试执行代码调试。

它总是显示不是我的代码发出的错误消息,调试器也被中断。

  

未处理的异常:       NoSuchMethodError:在空调用getter'cls'。       接收者:null       尝试致电:cls       #0 Object.noSuchMethod(dart:core-patch / object_patch.dart:50:5)       #1 BodyBuilder.lookupInstanceMember(package:front_end / src / fasta / kernel / body_builder.dart:1604:30)       #2 BodyBuilder.scopeLookup(包:front_end / src / fasta / kernel / body_builder.dart:1764:13)       #3 BodyBuilder.handleIdentifier(package:front_end / src / fasta / kernel / body_builder.dart:1700:12)       #4 Parser.ensureIdentifier(package:front_end / src / fasta / parser / parser.dart:2165:14)       #5 Parser.parseSend(package:front_end / src / fasta / parser / parser.dart:4932:32)       #6 Parser.parseSendOrFunctionLiteral(软件包:front_end / src / fasta / parser / parser.dart:4675:12)       #7 Parser.parsePrimary(软件包:front_end / src / fasta / parser / parser.dart:4233:14)       #8 Parser.parseUnaryExpression(软件包:front_end / src / fasta / parser / parser.dart:4172:12)       #9 Parser.parsePrecedenceExpression(软件包:front_end / src / fasta / parser / parser.dart:3961:13)       #10 Parser.parseExpression(软件包:front_end / src / fasta / parser / parser.dart:3933:13)       #11 BodyBuilder.parseSingleExpression(包:front_end / src / fasta / kernel / body_builder.dart:1111:20)       #12 SourceLoader.buildExpression(包:front_end / src / fasta / source / source_loader.dart:327:21)              #13 IncrementalCompiler.compileExpression。 (package:front_end / src / fasta / incremental_compiler.dart:795:61)              #14 CompilerContext.runInContext ..   (包:front_end / src / fasta / compiler_context.dart:122:46)       #15新的Future.sync(dart:async / future.dart:224:31)       #16 CompilerContext.runInContext。 (package:front_end / src / fasta / compiler_context.dart:122:19)       #17 _rootRun(dart:async / zone.dart:1124:13)       #18 _CustomZone.run(dart:async / zone.dart:1021:19)       #19 _runZoned(dart:async / zone.dart:1516:10)       #20 runZoned(dart:async / zone.dart:1463:12)       #21 CompilerContext.runInContext(package:front_end / src / fasta / compiler_context.dart:121:12)       #22 IncrementalCompiler.compileExpression(包:front_end / src / fasta / incremental_compiler.dart:726:26)              #23 IncrementalCompiler.compileExpression(软件包:vm / incremental_compiler.dart:156:23)       #24 FrontendCompiler.compileExpression(软件包:vm / frontend_server.dart:527:44)              #25 _FlutterFrontendCompiler.compileExpression(包:frontend_server / server.dart:62:22)       #26 listenAndCompile。 (软件包:vm / frontend_server.dart:812:20)              #27 _RootZone.runUnaryGuarded(dart:async / zone.dart:1314:10)       #28 _BufferingStreamSubscription._sendData(dart:async / stream_impl.dart:336:11)       #29 _BufferingStreamSubscription._add(dart:async / stream_impl.dart:263:7)       #30 _SinkTransformerStreamSubscription._add(dart:async / stream_transformers.dart:68:11)       #31 _EventSinkWrapper.add(dart:async / stream_transformers.dart:15:11)       #32 _StringAdapterSink.add(dart:convert / string_conversion.dart:236:11)       #33 _LineSplitterSink._addLines(dart:convert / line_splitter.dart:150:13)       #34 _LineSplitterSink.addSlice(dart:convert / line_splitter.dart:125:5)       #35 StringConversionSinkMixin.add(dart:convert / string_conversion.dart:163:5)       #36 _SinkTransformerStreamSubscription._handleData(dart:async / stream_transformers.dart:120:24)       #37 _RootZone.runUnaryGuarded(dart:async / zone.dart:1314:10)       #38 _BufferingStreamSubscription._sendData(dart:async / stream_impl.dart:336:11)       #39 _BufferingStreamSubscription._add(dart:async / stream_impl.dart:263:7)       #40 _SinkTransformerStreamSubscription._add(dart:async / stream_transformers.dart:68:11)       #41 _EventSinkWrapper.add(dart:async / stream_transformers.dart:15:11)       #42 _StringAdapterSink.add(dart:convert / string_conversion.dart:236:11)       #43 _StringAdapterSink.addSlice(dart:convert / string_conversion.dart:241:7)       #44 _Utf8ConversionSink.addSlice(dart:convert / string_conversion.dart:312:20)       #45 _Utf8ConversionSink.add(dart:convert / string_conversion.dart:305:5)       #46 _ConverterStreamEventSink.add(dart:convert / chunked_conversion.dart:72:18)       #47 _SinkTransformerStreamSubscription._handleData(dart:async / stream_transformers.dart:120:24)       #48 _RootZone.runUnaryGuarded(dart:async / zone.dart:1314:10)       #49 _BufferingStreamSubscription._sendData(dart:async / stream_impl.dart:336:11)       #50 _BufferingStreamSubscription._add(dart:async / stream_impl.dart:263:7)       #51 _SyncStreamController._sendData(dart:async / stream_controller.dart:764:19)       #52 _StreamController._add(dart:async / stream_controller.dart:640:7)       #53 _StreamController.add(dart:async / stream_controller.dart:586:5)       #54 _Socket._onData(dart:io-patch / socket_patch.dart:1786:41)       #55 _RootZone.runUnaryGuarded(dart:async / zone.dart:1314:10)       #56 _BufferingStreamSubscription._sendData(dart:async / stream_impl.dart:336:11)       #57 _BufferingStreamSubscription._add(dart:async / stream_impl.dart:263:7)       #58 _SyncStreamController._sendData(dart:async / stream_controller.dart:764:19)       #59 _StreamController._add(dart:async / stream_controller.dart:640:7)       #60 _StreamController.add(dart:async / stream_controller.dart:586:5)       #61新的_RawSocket。 (dart:io-patch / socket_patch.dart:1335:33)       #62 _NativeSocket.issueReadEvent.issue(dart:io-patch / socket_patch.dart:856:14)       #63 _microtaskLoop(dart:async / schedule_microtask.dart:41:21)       #64 _startMicrotaskLoop(dart:async / schedule_microtask.dart:50:5)       #65 _runPendingImmediateCallback(dart:isolate-patch / isolate_patch.dart:116:13)       #66 _RawReceivePortImpl._handleMessage(dart:isolate-patch / isolate_patch.dart:173:5)

我的代码: main.dart     void main()异步{

  Flame.images.loadAll(<String>[
    'level0.jpg'
  ]);

  Util flameUtil = Util();
  await flameUtil.fullScreen();
  await flameUtil.setOrientation(DeviceOrientation.portraitUp);
  MyGame game = MyGame ();
  runApp(game.widget);
 ....

mygame.dart:

......
      MyGame() {
        sprite = Sprite('level0.jpg');// Break point
      }
.............

注意:

I am using Android studio 3.1
flutter veriosn 1.7.8
channel stable

非常感谢!

0 个答案:

没有答案