MapBloc constructor
- {@required ShuttleRepository shuttleRepo,
- @required BusRepository busRepo,
- @required PrefsBloc prefsBloc}
MapBloc named constructor
Implementation
MapBloc(
{@required this.shuttleRepo,
@required this.busRepo,
@required this.prefsBloc})
: super(MapLoadingState()) {
rootBundle.loadString('assets/map_styles/aubergine.json').then((string) {
_darkMapStyle = string;
});
rootBundle.loadString('assets/map_styles/light.json').then((string) {
_lightMapStyle = string;
});
prefsStream = prefsBloc.listen((prefsState) {
if (prefsState is PrefsLoadedState) {
_enabledShuttles = prefsState.shuttles;
_enabledBuses = prefsState.buses;
if (_controller != null) {
_controller.setMapStyle(prefsState.theme.brightness == Brightness.dark
? _darkMapStyle
: _lightMapStyle);
}
}
});
}