Skip to content
pubscout

oktoast

3.4.0, released 3 years ago by an unverified publisher

A pure Flutter toast library supporting custom styles and widgets.

WASM-ready
$ flutter pub add oktoast
Source repository

What it does

Provides a toast notification system for Flutter applications. Allows displaying text messages or fully custom widgets as toasts without requiring a BuildContext at the call site.

AI-written summary of version 3.4.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to show simple temporary feedback messages across the app.
  • You want to display custom widget overlays as toasts.
  • You want to trigger toasts from anywhere in your code without passing BuildContext.

Skip it when

  • You need persistent snackbars with user action buttons (use ScaffoldMessenger instead).

Strengths

  • Does not require passing BuildContext for every toast call.
  • Fully customizable appearance using custom widgets.
  • Supports multiple platforms including Android, iOS, Web, Windows, macOS, and Linux.

Weaknesses

  • Requires wrapping your root widget (e.g., MaterialApp) with the OKToast widget.
  • Can throw errors if not integrated correctly with MediaQuery or MaterialApp builders.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Wrap your MaterialApp or root widget with OKToast.

import 'package:flutter/material.dart';
import 'package:oktoast/oktoast.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return OKToast(
      child: MaterialApp(
        home: Scaffold(
          body: Center(
            child: ElevatedButton(
              onPressed: () => showToast('Hello world'),
              child: Text('Show Toast'),
            ),
          ),
        ),
      ),
    );
  },
);

Alternatives

Packages that do the same job and could replace oktoast.

Works with

Packages commonly used together with oktoast: ones it builds on, ones built on it, and its own family.