代码之家  ›  专栏  ›  技术社区  ›  Vyacheslav

图像选取器取消时,Flutter调试器崩溃

  •  0
  • Vyacheslav  · 技术社区  · 6 年前

    当我取消图像库选取器,我的颤振调试器突然崩溃与这样的日志。这无法继续调试。 enter image description here

    可以跳过这个吗?或者这只是暂时的错误?

    Unhandled exception:
    NoSuchMethodError: The getter 'className' was called on null.
    Receiver: null
    Tried calling: className
    #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
    #1      serializeProcedure (package:front_end/src/fasta/kernel/utils.dart:99:29)
    #2      FrontendCompiler.compileExpression (package:vm/frontend_server.dart:482:16)
    <asynchronous suspension>
    #3      _FlutterFrontendCompiler.compileExpression (package:frontend_server/server.dart:62:22)
    #4      listenAndCompile.<anonymous closure> (package:vm/frontend_server.dart:797:20)
    <asynchronous suspension>
    #5      _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #8      _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
    #9      _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
    #10     _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
    #11     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154:13)
    #12     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129:5)
    #13     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189:5)
    #14     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
    #15     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #16     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #17     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #18     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
    #19     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
    #20     _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
    #21     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273:7)
    #22     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348:20)
    #23     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:341:5)
    #24     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86:18)
    #25     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
    #26     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #27     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #28     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #29     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
    #30     _StreamController._add (dart:async/stream_controller.dart:639:7)
    #31     _StreamController.add (dart:async/stream_controller.dart:585:5)
    #32     _Socket._onData (dart:io/runtime/binsocket_patch.dart:1721:41)
    #33     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #34     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #35     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #36     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
    #37     _StreamController._add (dart:async/stream_controller.dart:639:7)
    #38     _StreamController.add (dart:async/stream_controller.dart:585:5)
    #39     new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1283:33)
    #40     _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:826:14)
    #41     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    #42     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
    #43     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
    #44     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
    Unhandled exception:
    SocketException: Write failed (OS Error: Broken pipe, errno = 32), port = 0
    #0      _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1112:29)
    #1      _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    #2      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
    #3      _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
    #4      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
    

    这是我使用的代码

    var image = await ImagePicker.pickImage(source: ImageSource.gallery);
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Miguel Ruivo    6 年前

    您正在取消选取器,以便它返回 null 如预期。你应该处理好。

    你也有 file_picker