bokeh_generator 0.1.1

  • Readme
  • Changelog
  • Installing
  • 48

Bloc Boilerplate generator

import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:bokeh/bokeh.dart';

part 'authentication_bloc.g.dart';

/// Events
@protocol
abstract class _AuthenticationEvent {
  appStarted(int timestamp);
  credentialUpdated({String login, String password = "loremIpsum"});
  loggedIn();
  loggedOut();
}

/// States
@protocol
abstract class _AuthenticationState {
  idle();
  loading({int progress, String message});
  error(Exception e);
}

/// Bloc
@BlocOf(state: _AuthenticationState, event: _AuthenticationEvent)
class AuthenticationBloc
    extends Bloc<AuthenticationEvent, AuthenticationState> {
  @override
  AuthenticationState get initialState => AuthenticationState.idle();

  @override
  Stream<AuthenticationState> mapEventToState(
      AuthenticationEvent event) async* {
    yield* event.when(
      //
      appStarted: (_) async* {
        final current = state as Loading;
        yield current.copyWith(progress: 20);
        await Future.delayed(Duration(seconds: 2));
        yield AuthenticationState.idle();
        yield AuthenticationState.loading();
        await Future.delayed(Duration(seconds: 4));
        yield AuthenticationState.loading(progress: 200);
        yield AuthenticationState.idle();
      },
      //
      credentialUpdated: (_) async* {
        await Future.delayed(Duration());
      },

      //
      loggedOut: () async* {
        yield AuthenticationState.idle();
      },
      loggedIn: () async* {
        // skip
      },
    );
  }
}

Changelog #

0.1.0 #

  • Initial version.

0.1.1 #

  • pub.dev updates

Use this package as a library

1. Depend on it

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


dependencies:
  bokeh_generator: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:bokeh_generator/bokeh_generator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
1
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

2 out of 2 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/bokeh_generator.dart.

Run dartfmt to format lib/bokeh_generator.dart.

Maintenance suggestions

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 bokeh_generator.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
analyzer >=0.39.0 <0.40.0 0.39.6
bokeh ^0.1.0 0.1.1
build >=1.2.0 <1.3.0 1.2.2
code_builder >=3.2.0 <3.3.0 3.2.1
dart_style >=1.3.0 <1.4.0 1.3.4
recase ^3.0.0 3.0.0
source_gen >=0.9.0 <0.10.0 0.9.5
Transitive dependencies
_fe_analyzer_shared 2.1.0
args 1.6.0
async 2.4.1
built_collection 4.3.2
built_value 7.0.9
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
fixnum 0.10.11
glob 1.2.0
html 0.14.0+3
js 0.6.1+1
logging 0.11.4
matcher 0.12.6
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.3
path 1.6.4
pedantic 1.9.0
pub_semver 1.4.4
quiver 2.1.3
source_span 1.7.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+14
yaml 2.2.0
Dev dependencies
build_runner any
build_test any
test any