flutter_bloc_debug 0.2.0-dev

  • Readme
  • Changelog
  • Example
  • Installing
  • 28

flutter_bloc_debug #

A set of helper tools for debugging your BLoCs.

Bloc debug views #

If you start by designing your BLoCs, it can be tedious to test them in real condition (if you have native dependencies and so on), and sometimes you don't have time to create a full set of unit tests for them during your prototyping phase.

With BlocDebugger and BlocDebugDrawer, a form is generated to allow you to display all of the Streams values, and to send values to Sinks.


Quickstart #

class CounterBloc {
  Sink<int> get add => ...
  Sink<void> get reset => ...
  Stream<int> get count => ...
Widget build(BuildContext context) {
     return BlocDebugger(
      title: 'Counter',
      streams: {'count': this.bloc.count},
      sinks: {'add': this.bloc.add, 'reset': this.bloc.reset},
      child: Scaffold(
          body: Counter(this.bloc), // The view you're working on
          endDrawer: BlocDebugDrawer()),

Generated bloc debugger declaration #

If you use my other package built_bloc, all the metadata of a bloc is generated and you simply have to call BlocDebugger.fromMetadata(bloc.metadata, ...).

Examples #

For more detailled examples take a look at the example folder.

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.


import 'package:flutter/material.dart';
import 'counter/example.dart';
import 'todo_list/example.dart';

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

class MyApp extends StatelessWidget {
  final Map<String, WidgetBuilder> examples = {
    'Counter': (c) => CounterExample(),
    'TodoList': (c) => TodoExample(),

  // This widget is the root of your application.
  Widget build(BuildContext context) {
    final entries = examples.entries.toList();
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      home: Scaffold(
        appBar: AppBar(title: Text("Examples")),
        body: ListView.builder(
            itemCount: entries.length,
            itemBuilder: (c, i) => Card(
                margin: EdgeInsets.all(16.0),
                child: ListTile(
                  onTap: () {
                      builder: (c) => entries[i].value(c),
                  title: Text(entries[i].key),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_bloc_debug: ^0.2.0-dev

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_bloc_debug/flutter_bloc_debug.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 4, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Fix lib/src/widgets/bloc_debugger.dart. (-76.74 points)

Analysis of lib/src/widgets/bloc_debugger.dart failed with 5 errors, 4 hints, including:

line 9 col 8: Target of URI doesn't exist: 'package:rxdart/rxdart.dart'.

line 27 col 9: A redirecting constructor can't have an 'assert' initializer.

line 45 col 9: Undefined class 'BehaviorSubject'.

line 46 col 7: The method 'BehaviorSubject' isn't defined for the class '_BlocDebuggerState'.

line 115 col 9: Undefined class 'BehaviorSubject'.

Fix lib/src/widgets/renderers/debug_renderers.dart. (-1.49 points)

Analysis of lib/src/widgets/renderers/debug_renderers.dart reported 3 hints:

line 16 col 33: Set literals weren't supported until version 2.2, but this code is required to be able to run on earlier versions.

line 29 col 17: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

line 45 col 10: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Fix lib/src/widgets/history/entry.dart. (-0.50 points)

Analysis of lib/src/widgets/history/entry.dart reported 1 hint:

line 2 col 8: Unused import: 'package:flutter_bloc_debug/src/widgets/history/stream_entry.dart'.

Fix additional 15 files with analysis or formatting issues. (-1.50 points)

Additional issues in the following files:

  • lib/src/widgets/history/stream_entry.dart (1 hint)
  • lib/src/widgets/map_entry_view.dart (1 hint)
  • lib/src/widgets/renderers/form.dart (1 hint)
  • lib/flutter_bloc_debug.dart (Run flutter format to format lib/flutter_bloc_debug.dart.)
  • lib/src/helpers.dart (Run flutter format to format lib/src/helpers.dart.)
  • lib/src/widgets/divided_column.dart (Run flutter format to format lib/src/widgets/divided_column.dart.)
  • lib/src/widgets/history/history.dart (Run flutter format to format lib/src/widgets/history/history.dart.)
  • lib/src/widgets/map_view.dart (Run flutter format to format lib/src/widgets/map_view.dart.)
  • lib/src/widgets/renderers/custom.dart (Run flutter format to format lib/src/widgets/renderers/custom.dart.)
  • lib/src/widgets/renderers/default.dart (Run flutter format to format lib/src/widgets/renderers/default.dart.)
  • lib/src/widgets/renderers/list.dart (Run flutter format to format lib/src/widgets/renderers/list.dart.)
  • lib/src/widgets/renderers/map.dart (Run flutter format to format lib/src/widgets/renderers/map.dart.)
  • lib/src/widgets/renderers/renderer.dart (Run flutter format to format lib/src/widgets/renderers/renderer.dart.)
  • lib/src/widgets/renderers/string.dart (Run flutter format to format lib/src/widgets/renderers/string.dart.)
  • lib/src/widgets/sink_menu.dart (Run flutter format to format lib/src/widgets/sink_menu.dart.)

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Package is getting outdated. (-20.27 points)

The package was last published 62 weeks ago.

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
rxdart any