Skip to content

Commit

Permalink
flutter_bloc v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel committed Oct 26, 2018
1 parent 00d3dd2 commit ba5fe10
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
8 changes: 6 additions & 2 deletions packages/flutter_bloc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ Updates to `BlocBuilder` and `BlocProvider`

- `BlocBuilder` does not automatically dispose a `Bloc`. Developers are now responsible for determining when to call `Bloc.dispose()`
- `BlocProvider` support for `of(context)` with generics
- Support for multiple nested `BlocProviders` with different Bloc Types.
- Support for multiple nested `BlocProviders` with different Bloc Types.

# 0.2.1

Minor Updates to Documentation
Minor Updates to Documentation

# 0.3.0

Updated to `bloc: ^0.6.0`
2 changes: 1 addition & 1 deletion packages/flutter_bloc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

A Flutter package that helps implement the [Bloc pattern](https://www.youtube.com/watch?v=fahC3ky_zW0).

This package is built to work with [bloc](https://pub.dartlang.org/packages/bloc) 0.5.0+.
This package is built to work with [bloc](https://pub.dartlang.org/packages/bloc) ^0.6.0.

## Bloc Widgets

Expand Down
20 changes: 16 additions & 4 deletions packages/flutter_bloc/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@ class CounterPage extends StatelessWidget {

abstract class CounterEvent {}

class IncrementCounter extends CounterEvent {}
class IncrementCounter extends CounterEvent {
@override
String toString() => 'IncrementCounter';
}

class DecrementCounter extends CounterEvent {}
class DecrementCounter extends CounterEvent {
@override
String toString() => 'DecrementCounter';
}

class CounterBloc extends Bloc<CounterEvent, int> {
int get initialState => 0;

void increment() {
dispatch(IncrementCounter());
}
Expand All @@ -86,6 +90,14 @@ class CounterBloc extends Bloc<CounterEvent, int> {
dispatch(DecrementCounter());
}

@override
int get initialState => 0;

@override
void onTransition(Transition<CounterEvent, int> transition) {
print(transition.toString());
}

@override
Stream<int> mapEventToState(int state, CounterEvent event) async* {
if (event is IncrementCounter) {
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_bloc/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_bloc
description: Flutter Widgets that make it easy to implement the BLoC Design Pattern (Business Logic Component). Built to be used with the bloc package.
version: 0.2.1
version: 0.3.0
author: felix.angelov <[email protected]>
homepage: https://github.com/felangel/bloc/tree/master/packages/flutter_bloc

Expand All @@ -9,7 +9,7 @@ environment:

dependencies:
rxdart: ">=0.18.1 <1.0.0"
bloc: ^0.5.0
bloc: ^0.6.0
flutter:
sdk: flutter

Expand Down
3 changes: 3 additions & 0 deletions packages/flutter_bloc/test/bloc_provider_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class CounterBloc extends Bloc<CounterEvent, int> {
}

class SimpleBloc extends Bloc<dynamic, String> {
@override
String get initialState => '';

@override
Stream<String> mapEventToState(String state, dynamic event) async* {
yield 'state';
Expand Down

0 comments on commit ba5fe10

Please sign in to comment.