init static method

Widget Function(BuildContext context, Widget? child)? init()

Initializes the FlashyFlushbarProvider to provide the build context for the FlashyFlushbar widget.

This function should be used when wrapping your app with FlashyFlushbarProvider to ensure that the FlashyFlushbar widget can access the correct build context for overlay insertion.

The init function returns a widget function that takes a BuildContext and an optional child widget. It wraps the provided child with the FlashyFlushbarProvider and sets it as a child of the overlay. If no child is provided, it defaults to an empty SizedBox.

Example usage:

 void main() => runApp(MyApp());

 class MyApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
 return MaterialApp(
 home: HomePage(),
 // here
 builder: FlashyFlushbarProvider.init(),
 );
 }
 }

Implementation

static Widget Function(BuildContext context, Widget? child)? init() {
  return (context, child) => FlashyFlushbarProvider(child: child);
}