flutter_bloc_effects 1.0.1 copy "flutter_bloc_effects: ^1.0.1" to clipboard
flutter_bloc_effects: ^1.0.1 copied to clipboard

A lightweight companion to flutter_bloc that adds effect streams, listeners, and helpers for one-off UI side effects like navigation, snackbars, and dialogs.

example/lib/main.dart

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

import 'cubit/counter_cubit.dart';
import 'cubit/cubit_example_page.dart';
import 'bloc/login_bloc.dart';
import 'bloc/bloc_example_page.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Bloc Effects Example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
        useMaterial3: true,
      ),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter Bloc Effects Examples'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (_) => BlocProvider(
                      create: (_) => CounterCubit(),
                      child: const CubitExamplePage(),
                    ),
                  ),
                );
              },
              child: const Text('Cubit Example'),
            ),
            const SizedBox(height: 16),
            ElevatedButton(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (_) => BlocProvider(
                      create: (_) => LoginBloc(),
                      child: const BlocExamplePage(),
                    ),
                  ),
                );
              },
              child: const Text('Bloc Example'),
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
160
points
197
downloads

Publisher

verified publisherretozu.com

Weekly Downloads

A lightweight companion to flutter_bloc that adds effect streams, listeners, and helpers for one-off UI side effects like navigation, snackbars, and dialogs.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_bloc, provider

More

Packages that depend on flutter_bloc_effects