Skip to content

Commit

Permalink
pub score imporvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ponnamkarthik committed Apr 15, 2024
1 parent 224b2bf commit cb37e71
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions lib/fluttertoast.dart
Expand Up @@ -138,7 +138,7 @@ class FToast {
/// the overlay to the screen
///
_showOverlay() {
if (_overlayQueue.length == 0) {
if (_overlayQueue.isEmpty) {
_entry = null;
return;
}
Expand All @@ -161,7 +161,7 @@ class FToast {
// removeQueuedCustomToasts();
// return; // Or maybe thrown error too
// }
var _overlay;
OverlayState? _overlay;
try {
_overlay = Overlay.of(context!);
} catch (err) {
Expand All @@ -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);
Expand Down

0 comments on commit cb37e71

Please sign in to comment.