show method

void show()

Displays the flushbar by creating an overlay entry.

The flushbar will be removed automatically after the specified duration. If onTap is provided, tapping the flushbar will execute the callback and hide the flushbar.

Implementation

void show() {
  final overlay = OverlayEntry(builder: (BuildContext context) {
    return this;
  });
  if (FlashyProxy.buildContext == null) {
    throw Exception("FlashyProxy.buildContext is null, please use FlashyFlushbarProvider");
  }

  Overlay.of(FlashyProxy.buildContext!, debugRequiredFor: this).insert(overlay);
  FlashyProxy.entries[UniqueKey()] = overlay;
  Future.delayed((animationDuration * 2) + (duration) + const Duration(milliseconds: 300), () {
    if (overlay.mounted) {
      overlay.remove();
    }
  });
}