Handy toast for flutter Pub version

A toast for flutter and easy to use! Depends on context_holder

1. Add dependency

dependencies:
  handy_toast: ^0.0.3

2. Init context holder.

Import context holder.

import 'package:context_holder/context_holder.dart';

Set your root app's navigatorKey with ContextHolder.key

For MaterialApp

void main() {
  runApp(
    MaterialApp(
      /// must set the navigatorKey!!!!!!
      navigatorKey: ContextHolder.key,
      home: Scaffold(),
    ),
  );
}

For CupertinoApp

void main() {
  runApp(
    CupertinoApp(
      /// must set the navigatorKey!!!!!!
      navigatorKey: ContextHolder.key,
      home: Scaffold(),
    ),
  );
}

3. Import easy toast

import 'package:handy_toast/handy_toast.dart';

4. Use easy toast

'handy toast'.toast();

4. Other option

Change default style.

/// change toast background color to green with opacity.
Toast.defaultStyle = ToastStyle(
  color: Colors.green.withOpacity(0.8),
);

Libraries

handy_toast