From cb37e711606be63e429bdf76af4fce8a07825f15 Mon Sep 17 00:00:00 2001 From: Karthik Ponnam Date: Mon, 15 Apr 2024 14:06:08 +0530 Subject: [PATCH] pub score imporvements --- lib/fluttertoast.dart | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/fluttertoast.dart b/lib/fluttertoast.dart index c6234d2a..26a1487c 100644 --- a/lib/fluttertoast.dart +++ b/lib/fluttertoast.dart @@ -138,7 +138,7 @@ class FToast { /// the overlay to the screen /// _showOverlay() { - if (_overlayQueue.length == 0) { + if (_overlayQueue.isEmpty) { _entry = null; return; } @@ -161,7 +161,7 @@ class FToast { // removeQueuedCustomToasts(); // return; // Or maybe thrown error too // } - var _overlay; + OverlayState? _overlay; try { _overlay = Overlay.of(context!); } catch (err) { @@ -173,16 +173,6 @@ class FToast { - https://github.com/ponnamkarthik/FlutterToast/issues/393 - 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 _ToastEntry _toastEntry = _overlayQueue.removeAt(0);