createView static method Null safety

void createView(
  1. BuildContext context,
  2. {IconData? icon,
  3. Color? backgroundColor,
  4. required String title,
  5. required String description,
  6. required int duration,
  7. required Gravity gravity}
)

Implementation

static void createView(
  BuildContext context, {
  IconData? icon,
  Color? backgroundColor,
  required String title,
  required String description,
  required int duration,
  required Gravity gravity,
}) {
  _overlayState = Navigator.of(context).overlay;

  if (!_isVisible) {
    _isVisible = true;

    _overlayEntry = OverlayEntry(
      builder: (context) {
        return EdgeOverlay(
          title: title,
          description: description,
          overlayDuration: duration,
          gravity: gravity,
          backgroundColor: backgroundColor ?? Theme.of(context).primaryColor,
          icon: icon,
        );
      },
    );

    _overlayState!.insert(_overlayEntry!);
  }
}