bsev 0.8.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 93

pub package

BSEV (BloC,Streams,Events,View) #

Set of packages and utilitarian functions that help in the use of BloC pattern with dependency injection.

With bsev you will use the Bloc pattern in a simple, reactive and organized way. Communication between the business logic and the view occurs entirely through two-way streams.


Usage #

To use this plugin, add bsev as a dependency in your pubspec.yaml file.

We should initially create the class that represents our Streams and Events:

Streams #

import 'package:bsev/bsev.dart';

class HomeStreams extends StreamsBase{

  var count = BehaviorSubjectCreate<Int>(initValue: 0);
  //var count = StreamCreate<Int>();
  //var count = PublishSubjectCreate<Int>();
  //var count = ReplaySubjectCreate<Int>();

  void dispose() {


Events #

import 'package:bsev/bsev.dart';

class IncrementEvent extends EventsBase{}

Now we can create our Bloc, class that will be centralized the business rule.

Bloc #

import 'package:bsev/bsev.dart';

    class HomeBloc extends BlocBase<HomeStreams>{

  //If you need to communicate with some instantiated BloC, regardless of whether part of your tree of widgets can use:
  //If you need to send an event to the view:

  void initView() {
  void eventReceiver(EventsBase event) {
  // called when the Bloc receives an event
    if(event is IncrementEvent){
      streams.count.set(streams.count.value + 1)

Note: If you do not want to use events (for a screen that only starts, loads and displays data) you can use EventsBase as an event. Ex: BlocBase <HomeStreams, EventsBase>

In our bloc we have 2 mandatory methods: initState and eventReceiver:

initView: In the first buildView this method is invoked;

eventReceiver: Invoked whenever the pad receives an event;

View #

import 'package:bsev/bsev.dart';

class HomeView extends StatelessWidget{
  Widget build(BuildContext context) {
    return Bsev<HomeBloc,HomeStreams>(
      dataToBloc: "any data", //optional initial data to bloc
      eventReceiver: (context, event, dispatcher){ //optional
        // performs action received by the bloc
      builder: (context, dispatcher, streams){
          return Scaffold(
            appBar: AppBar(),
            body: _buildBody(streams),
            floatingActionButton: FloatingActionButton(
                onPressed: (){
  Widget _buildBody(HomeStreams streams) {

    return StreamBuilder(
      stream: streams.count.get,
      initialData: 0,
      builder: (_,snapshot){

        int count = 0;
          count =;

        return Center(
          child: Text(count.toString())


As our Bloc and our StreamsBase will be injected automatically, we should configure it in the Injector in the main of our application:


    var injector = Injector.appInstance;
    injector.registerDependency((i)=> HomeBloc());
    injector.registerDependency((i)=> HomeStreams());

Questions about how to use the injector consult documentation.

More complex example is found here: exemplo

Used packages #


User cases #

--------- | FlutterNews | DartLangBr | Boleiro |

[0.8.7] - 26/09/2019

  • removes need for custom EventBase

[0.8.6] - 15/09/2019

  • version without context in Bloc

[0.8.5] - 15/09/2019

  • update rxdart
  • version with context in Bloc

[0.8.4] - 14/06/2019

  • update example
  • remove access context in bloc

[0.8.3] - 17/06/2019

  • add context in eventReceiver

[0.8.2] - 14/06/2019

  • remove need from package provider

[0.8.1] - 14/06/2019

  • Otimizations

[0.8.0] - 14/06/2019

  • Version with Widget

[0.7.1] - 12/06/2019

  • Remove context from view in bloc

[0.7.0] - 12/06/2019

  • Fix bug dispatcher multiple instance same bloc

[0.6.5] - 15/05/2019

  • Remove context from view in bloc

[0.6.1] - 15/05/2019

  • Fixin warns pub

[0.6.0] - 15/05/2019

  • Optimizations BlocViewMixin

[0.5.5] - 15/05/2019

  • Optimizations BlocView

[0.5.0] - 15/05/2019

  • ADD Dispatcher

[0.1.0] - 15/05/2019

  • ADD provider
  • Optimizations

[0.0.5] - 11/05/2019

  • ADD injector

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.


bsev_demo #

A new Flutter application.

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:

  bsev: ^0.8.7

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support 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:bsev/bsev.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 Oct 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-0.70 points)

99 out of 100 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.

Fix lib/bsev.dart. (-0.50 points)

Analysis of lib/bsev.dart reported 1 hint:

line 20 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: Bsev.builderInner


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
injector ^1.0.8 1.0.8
rxdart ^0.22.2 0.22.4
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies