tetris_blocs 0.0.1

  • README.md
  • Installing
  • Versions
  • new42

Tetris #

BLoCs for Flutter made easy.

Build Status

Goals #

Simplicity #

Write the Code you need with as minimal Boilerplate as possible

RxDart Syntax #

Feel at Home

Flexibility #

Be usefull everywhere, even in now-unknown places

Chaining #

Yo dawg, I heard you like Blocs, so I put some Blocs in your Blocs, so now you can play Tetris while playing Tetris



TetrisEvent(action, payload) #

An Event happening in your App, originating by UI or somewhere else. TetrisEvents are fully described by

  • String action The action you expect to happen
  • String type Optional Type of event
  • dynamic payload Any type of Object you want to process

TetrisBloc #

A TetrisBloc is an asynchronous Event Processor. It handles events sourced through


in its

Stream<TetrisEvent> processEvent(TetrisEvent event)

function and yields a (new) event as a result.

TetrisProvider #

TetrisProvicer is a DI Container that provides instances of your TetrisBloc's to Widgets in your App.
A Provider can hold multiple BLoCs and you can have multiple Providers in your App. To retrieve a BLoC from the Provider call

var bloc = TetrisProvider.of<MyBloc>(context) 

TetrisBuilder #

TetrisBuilder is similar to StreamBuilder in that it will rebuild your Widgets on incoming TetrisEvents A Single Builder can receive Events from multiple BLoCs. It has a withFilter Constructor that allows you to drop Events that are not of interest.

      blocs: [myFirstBloc, mySecondBloc],
      builder: (BuildContext context, TetrisEvent event) { return Text(event.action) },
      filter: (TetrisEvent event){ return event.action == "accept"; }

Examples #

Loading a List #

With Simplicity in Mind, loading a List is down to two lines of code. To Trigger the Action:


And the full implementation of the Bloc is this:

 class MyTetrisBloc extends TetrisBloc {
    Stream<TetrisEvent> processEvent(TetrisEvent event) async* {
      yield TetrisEvent.withPayload("loadList",[1,3,5,7]);

Example Project #

The classic "Button Clicker" Example is here

Contributors #

  • @dividebyzero :shipit:
  • Your name here ?

[1.0.0] - 12. April 2019

  • Initial Release provides all base funtionality of BLoCs

Use this package as a library

1. Depend on it

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

  tetris_blocs: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

import 'package:tetris_blocs/tetris_blocs.dart';
Version Uploaded Documentation Archive
0.0.1 Apr 12, 2019 Go to the documentation of tetris_blocs 0.0.1 Download tetris_blocs 0.0.1 archive
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 Apr 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/core/tetris_bloc.dart. (-0.50 points)

Analysis of lib/core/tetris_bloc.dart reported 1 hint:

line 26 col 3: The class 'Stream' 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/core/tetris_builder.dart. (-0.50 points)

Analysis of lib/core/tetris_builder.dart reported 1 hint:

line 64 col 23: Cancel instances of dart.async.StreamSubscription.

Fix lib/core/tetris_event.dart. (-0.50 points)

Analysis of lib/core/tetris_event.dart reported 1 hint:

line 33 col 15: Name non-constant identifiers using lowerCamelCase.

Format lib/core/tetris_provider.dart.

Run flutter format to format lib/core/tetris_provider.dart.

Format lib/tetris_blocs.dart.

Run flutter format to format lib/tetris_blocs.dart.

Maintenance suggestions

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

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
rxdart ^0.21.0 0.21.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