bloc_event_gen 0.1.3

Getting Started #

Add the packages to your pubspec.yaml file:

  bloc_event_gen: ^[latest version]

  build_runner: ^1.5.2 # Also depend on build_runner if you aren't already.
  bloc_event_generator: ^[latest version]

Annotate your BLoC class with BlocEvents:

  'NavigateToAwesomePage': {},
  'ShowSnackBar': {
    'message': String,
    'duration': Duration,
class HomeBloc // ...

Specify the part file for the generator code:

part 'your_bloc_file_name.g.dart';

Run the build:

$ flutter pub run build_runner build

...or have it watch for changes:

$ flutter pub run build_runner watch

The output will be the following code in the your_bloc_file_name.g.dart file:

class NavigateToAwesomePage extends BlocEvent {

class ShowSnackBar extends BlocEvent {
  final String message;
  final Duration duration;
  ShowSnackBar(this.message, this.duration);

See the example project for a working example.

0.1.0 #

  • Initial version

Use this package as a library

1. Depend on it

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

  bloc_event_gen: ^0.1.3

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:bloc_event_gen/bloc_event_gen.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 Feb 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Format lib/src/bloc_event.dart.

Run dartfmt to format lib/src/bloc_event.dart.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field was unreachable.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and bloc_event_gen.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0