Commit cb37e711 by Karthik Ponnam

pub score imporvements

parent 224b2bf9
...@@ -138,7 +138,7 @@ class FToast { ...@@ -138,7 +138,7 @@ class FToast {
/// the overlay to the screen /// the overlay to the screen
/// ///
_showOverlay() { _showOverlay() {
if (_overlayQueue.length == 0) { if (_overlayQueue.isEmpty) {
_entry = null; _entry = null;
return; return;
} }
...@@ -161,7 +161,7 @@ class FToast { ...@@ -161,7 +161,7 @@ class FToast {
// removeQueuedCustomToasts(); // removeQueuedCustomToasts();
// return; // Or maybe thrown error too // return; // Or maybe thrown error too
// } // }
var _overlay; OverlayState? _overlay;
try { try {
_overlay = Overlay.of(context!); _overlay = Overlay.of(context!);
} catch (err) { } catch (err) {
...@@ -173,16 +173,6 @@ class FToast { ...@@ -173,16 +173,6 @@ class FToast {
- https://github.com/ponnamkarthik/FlutterToast/issues/393 - https://github.com/ponnamkarthik/FlutterToast/issues/393
- https://github.com/ponnamkarthik/FlutterToast/issues/234"""); - https://github.com/ponnamkarthik/FlutterToast/issues/234""");
} }
if (_overlay == null) {
/// Need to clear queue
removeQueuedCustomToasts();
throw ("""Error: Overlay is null.
Please don't use top of the widget tree context (such as Navigator or MaterialApp) or
create overlay manually in MaterialApp builder.
More information
- https://github.com/ponnamkarthik/FlutterToast/issues/393
- https://github.com/ponnamkarthik/FlutterToast/issues/234""");
}
/// Create entry only after all checks /// Create entry only after all checks
_ToastEntry _toastEntry = _overlayQueue.removeAt(0); _ToastEntry _toastEntry = _overlayQueue.removeAt(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment