handy_toast 0.0.4 copy "handy_toast: ^0.0.4" to clipboard
handy_toast: ^0.0.4 copied to clipboard

A toast for flutter and very easy to use! This package depends on context_holder, another very useful package.

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.4

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),
);
1
likes
130
pub points
39%
popularity

Publisher

unverified uploader

A toast for flutter and very easy to use! This package depends on context_holder, another very useful package.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

context_holder, flutter

More

Packages that depend on handy_toast