-
Notifications
You must be signed in to change notification settings - Fork 1
/
bloc_flutter.dart
44 lines (35 loc) · 983 Bytes
/
bloc_flutter.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:meta/meta.dart';
class ConnectivityBloc extends Bloc<ConnectivityEvent, ConnectivityState> {
ConnectivityBloc() : super(ConnectivityState.initial());
@override
Stream<ConnectivityState> mapEventToState(ConnectivityEvent event) async* {
if (event is AppLaunchedConnectivityEvent) {
}
}
}
abstract class ConnectivityEvent {}
class AppLaunchedConnectivityEvent extends ConnectivityEvent {}
@immutable
class ConnectivityState {
final bool isLoading;
final bool isError;
const ConnectivityState._({
this.isLoading = false,
this.isError = false,
});
const ConnectivityState.initial()
: this._(
isLoading: true,
isError: false,
);
ConnectivityState copyWith({
bool? isLoading,
bool? isError,
}) {
return ConnectivityState._(
isLoading: isLoading ?? this.isLoading,
isError: isError ?? this.isError,
);
}
}