Skip to content

Commit c851b31

Browse files
authored
Merge pull request brianegan#137 from felangel/update/bloc-library
update to flutter_bloc 0.14.0 override rxdart version
2 parents 9c99d2d + fcf75df commit c851b31

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

bloc_library/lib/blocs/simple_bloc_delegate.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import 'package:bloc/bloc.dart';
88
// in order to handle transitions and errors from all Blocs.
99
class SimpleBlocDelegate extends BlocDelegate {
1010
@override
11-
void onTransition(Transition transition) {
12-
super.onTransition(transition);
11+
void onTransition(Bloc bloc, Transition transition) {
12+
super.onTransition(bloc, transition);
1313
print(transition);
1414
}
1515

1616
@override
17-
void onError(Object error, StackTrace stacktrace) {
18-
super.onError(error, stacktrace);
17+
void onError(Bloc bloc, Object error, StackTrace stacktrace) {
18+
super.onError(bloc, error, stacktrace);
1919
print(error);
2020
}
2121
}

bloc_library/lib/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void main() {
1717
// BlocSupervisor oversees Blocs and delegates to BlocDelegate.
1818
// We can set the BlocSupervisor's delegate to an instance of `SimpleBlocDelegate`.
1919
// This will allow us to handle all transitions and errors in SimpleBlocDelegate.
20-
BlocSupervisor().delegate = SimpleBlocDelegate();
20+
BlocSupervisor.delegate = SimpleBlocDelegate();
2121
runApp(BlocApp());
2222
}
2323

bloc_library/pubspec.yaml

+7-13
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,18 @@ environment:
77
dependencies:
88
meta: ">=1.1.0 <2.0.0"
99
equatable: ^0.2.0
10-
flutter_bloc: ^0.10.0
10+
flutter_bloc: ^0.14.0
11+
todos_app_core:
12+
path: ../todos_app_core
13+
todos_repository_simple:
14+
path: ../todos_repository_simple
1115
flutter:
1216
sdk: flutter
1317

1418
dependency_overrides:
15-
todos_app_core:
16-
git:
17-
url: https://github.com/felangel/flutter_architecture_samples
18-
path: todos_app_core
19-
ref: expose-repositories
20-
todos_repository_simple:
21-
git:
22-
url: https://github.com/felangel/flutter_architecture_samples
23-
path: todos_repository_simple
24-
ref: expose-repositories
25-
rxdart: '0.21.0'
19+
rxdart: ^0.22.0
20+
2621
dev_dependencies:
27-
test: ^1.3.0
2822
mockito: ^3.0.0
2923
flutter_driver:
3024
sdk: flutter

bloc_library/test/blocs/simple_bloc_delegate_test.dart

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,29 @@
33
// in the LICENSE file.
44

55
import 'package:flutter_test/flutter_test.dart';
6+
import 'package:mockito/mockito.dart';
67
import 'package:bloc_library/blocs/simple_bloc_delegate.dart';
78
import 'package:bloc/bloc.dart';
89
import 'dart:async';
910

11+
class MockBloc extends Mock implements Bloc {}
12+
1013
var printLog;
1114

1215
main() {
1316
group('SimpleBlocDelegate', () {
1417
SimpleBlocDelegate delegate;
18+
MockBloc bloc;
1519

1620
setUp(() {
1721
delegate = SimpleBlocDelegate();
22+
bloc = MockBloc();
1823
printLog = [];
1924
});
2025

2126
test('onTransition prints Transition', overridePrint(() {
2227
delegate.onTransition(
28+
bloc,
2329
Transition(currentState: 'A', event: 'E', nextState: 'B'),
2430
);
2531
expect(
@@ -29,7 +35,7 @@ main() {
2935
}));
3036

3137
test('onError prints Error', overridePrint(() {
32-
delegate.onError('whoops', null);
38+
delegate.onError(bloc, 'whoops', null);
3339
expect(
3440
printLog[0],
3541
'whoops',

0 commit comments

Comments
 (0)