m3_lightmeter/lib/screens/metering/ev_source/random_ev/bloc_random_ev.dart
Vadim 14bac950cf Fixed _models_ and _screens_ folders structure
proper folders for models

unified _screen_ folder filenames
2022-12-18 14:39:02 +03:00

25 lines
1,021 B
Dart

import 'dart:math';
import 'package:lightmeter/screens/metering/ev_source/ev_source_bloc.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart' as communication_event;
import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart' as communication_states;
import 'event_random_ev.dart';
import 'state_random_ev.dart';
class RandomEvBloc extends EvSourceBloc<RandomEvEvent, RandomEvState> {
final random = Random();
RandomEvBloc(MeteringCommunicationBloc communicationBloc)
: super(
communicationBloc,
RandomEvState(Random().nextDouble() * 15),
);
@override
void onCommunicationState(communication_states.SourceState communicationState) {
if (communicationState is communication_states.MeasureState) {
communicationBloc.add(communication_event.MeasuredEvent(random.nextDouble() * 15));
}
}
}