flutter_bloc_debug 0.2.0-dev

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.

example

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.

example/README.md

example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
30
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
75
Overall:
Weighted score of the above. [more]
24
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms:

Low code quality prevents platform classification.

Health issues and suggestions

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

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

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

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

line 5 col 8: Unused import: 'package:flutter_bloc_debug/src/widgets/history/entry.dart'.

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

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

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

line 45 col 10: The class 'Future' was not 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

Fix platform conflicts. (-20 points)

Low code quality prevents platform classification.

Package is pre-release. (-5 points)

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

Dependencies

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
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
rxdart any

Admin