dash_generator 0.5.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 71

Dash Generator #

Logo

Generates provider source code using dash library.

IMPORTANT: Dart2 is required to use this package.

Installation #

  • Add dash to your pubspec.yaml under the dependencies section:
dependencies:
  dash: ^latest_version
  • Add build_runner and dash_generator to your pubspec.yaml under the dev_dependencies section:
dev_dependencies:
  build_runner: ^1.1.3
  dash_generator: ^latest_version

Usage #

1 - Create a provider class that is going to gathering all BlocProvider annotation:

IMPORTANT: Do not forget to add: part 'provider.g.dart';.

import 'package:dash/dash.dart';

part 'provider.g.dart';

@BlocProvider.register(MySampleBloc)
@BlocProvider.register(MyOtherBloc)
abstract class Provider {}

2 - Extends all your bloc class from Bloc. It will allow you to override dispose method.

IMPORTANT: All bloc class must has an instance() function that returns the instance of the bloc class as bellow.

class MySampleBloc extends Bloc {

  @override
  dispose() {
    //close all streams
  }

  static Bloc instance() => MySampleBloc();
  
}

class MyOtherBloc extends Bloc {

  @override
  dispose() {
    //close all streams
  }

  static Bloc instance() => MyOtherBloc();
}

3 - Run build_runner, it will generate the provider.g.dart class that you added as part on your provider class.

On project directory run on terminal:

pub run build_runner build

For flutter is:

flutter packages pub run build_runner build

Note: If you encounter a conflict error, please add the --delete-conflicting-outputs argument to your command:

flutter packages pub run build_runner build --delete-conflicting-outputs

4 - Finally you can get your bloc class instance from wherever you want, example:

@override
  Widget build(BuildContext context) {
    final _bloc = $Provider.of<MyOtherBloc>();

    return Container();
  }

Changelog #

Please see the Changelog page to know what's recently changed.

[0.5.3] - March/2019

  • Added LICENSE
  • Formated code
  • Updated reademe
  • Run analyses
  • Added test

[0.5.2] - March/2019

  • Updated dash version

[0.5.1] - March/2019

  • Improves the code generation

example/main.dart

import 'bloc_example.dart';
import 'provider.dart';

class Main {
  BlocExample provideBlocExample() => $Provider.of<BlocExample>();

  disposeBlocExample() => $Provider.dispose<BlocExample>();
}

Use this package as a library

1. Depend on it

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


dependencies:
  dash_generator: ^0.5.3

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:dash_generator/dash_generator.dart';
  
Version Uploaded Documentation Archive
0.5.3 Mar 25, 2019 Go to the documentation of dash_generator 0.5.3 Download dash_generator 0.5.3 archive
0.5.2 Mar 19, 2019 Go to the documentation of dash_generator 0.5.2 Download dash_generator 0.5.2 archive
0.5.0 Mar 16, 2019 Go to the documentation of dash_generator 0.5.0 Download dash_generator 0.5.0 archive
0.4.3 Mar 9, 2019 Go to the documentation of dash_generator 0.4.3 Download dash_generator 0.4.3 archive
0.4.0 Feb 8, 2019 Go to the documentation of dash_generator 0.4.0 Download dash_generator 0.4.0 archive
0.3.0 Feb 3, 2019 Go to the documentation of dash_generator 0.3.0 Download dash_generator 0.3.0 archive
0.2.0 Feb 3, 2019 Go to the documentation of dash_generator 0.2.0 Download dash_generator 0.2.0 archive
0.1.0 Jan 28, 2019 Go to the documentation of dash_generator 0.1.0 Download dash_generator 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: other

Primary library: package:dash_generator/dash_generator.dart with components: io, build, mirrors.

Health suggestions

Format lib/src/bloc_provider_generator.dart.

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
analyzer ^0.35.0 0.35.4 0.36.2
build ^1.1.1 1.1.3
built_collection ^4.1.0 4.2.0
code_builder ^3.1.3 3.2.0
dart_style ^1.2.4 1.2.4 1.2.7
dash ^0.5.3 0.5.3
source_gen ^0.9.4 0.9.4+2
test ^1.0.0 1.6.2
Transitive dependencies
args 1.5.1
async 2.2.0
boolean_selector 1.0.4
built_value 6.4.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
fixnum 0.10.9
front_end 0.1.14 0.1.17
glob 1.1.7
http 0.12.0+2
http_multi_server 2.0.5
http_parser 3.1.3
io 0.3.3
js 0.6.1+1
json_rpc_2 2.1.0
kernel 0.3.14 0.3.17
logging 0.11.3+2
matcher 0.12.5
meta 1.1.7
mime 0.9.6+2
multi_server_socket 1.0.2
node_preamble 1.4.4
package_config 1.0.5
package_resolver 1.0.10
path 1.6.2
pool 1.4.0
pub_semver 1.4.2
quiver 2.0.3
shelf 0.7.5
shelf_packages_handler 1.0.4
shelf_static 0.2.8
shelf_web_socket 0.2.3
source_map_stack_trace 1.1.5
source_maps 0.10.8
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
string_scanner 1.0.4
term_glyph 1.1.0
test_api 0.2.5
test_core 0.2.4
typed_data 1.1.6
vm_service_client 0.2.6+1
watcher 0.9.7+10
web_socket_channel 1.0.12
yaml 2.1.15
Dev dependencies
build_runner ^1.2.8
pedantic 1.4.0 1.5.0