bloc_preview 1.0.0 copy "bloc_preview: ^1.0.0" to clipboard
bloc_preview: ^1.0.0 copied to clipboard

A zero-configuration BLoC state inspector with a built-in web dashboard. Attach it as a BlocObserver to visualize state changes, events, and errors in real time directly in your browser — no external [...]

example/lib/main.dart

// ignore_for_file: depend_on_referenced_packages

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

import 'home/home_page.dart';
import 'theme/cubit/theme_cubit.dart';

void main() {
  Bloc.observer = BlocPreviewObserver();
  runApp(const DemoApp());
}

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

  @override
  Widget build(BuildContext context) {
    return BlocProvider(
      create: (_) => ThemeCubit(),
      child: BlocBuilder<ThemeCubit, ThemeState>(
        builder: (context, themeState) {
          return MaterialApp(
            title: 'bloc_preview demo',
            debugShowCheckedModeBanner: false,
            themeMode: themeState.themeMode,
            theme: ThemeData(
              colorSchemeSeed: themeState.seedColor,
              brightness: Brightness.light,
              useMaterial3: true,
            ),
            darkTheme: ThemeData(
              colorSchemeSeed: themeState.seedColor,
              brightness: Brightness.dark,
              useMaterial3: true,
            ),
            home: const HomePage(),
          );
        },
      ),
    );
  }
}
1
likes
150
points
135
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A zero-configuration BLoC state inspector with a built-in web dashboard. Attach it as a BlocObserver to visualize state changes, events, and errors in real time directly in your browser — no external tools required.

Repository (GitHub)
View/report issues

Topics

#bloc #state-management #debugging #devtools #inspector

License

MIT (license)

Dependencies

bloc

More

Packages that depend on bloc_preview