flutter_zxing
flutter_zxing copied to clipboard
used build context asynchronously without checking mounted
This error always occurs when I pop the screen before its initialized.
To fix this you just need to check if the widget is still mounted. You can find the setState in the file "flutter_zxing/src/ui/reader_widget.dart" in line 200, if it is true what the stacktrace says.
Error:
setState() called after dispose(): _ReaderWidgetState#c4ea6(lifecycle state: defunct, not mounted)
StackTrace:
State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1167:9)
State.setState (package:flutter/src/widgets/framework.dart:1202:6)
_ReaderWidgetState.initStateAsync.<anonymous closure> (package:flutter_zxing/src/ui/reader_widget.dart:200:7)
_rootRunUnary (dart:async/zone.dart:1407:47)
_CustomZone.runUnary (dart:async/zone.dart:1308:19)
Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:847:45)
Future._propagateToListeners (dart:async/future_impl.dart:876:13)
Future._completeWithValue (dart:async/future_impl.dart:652:5)