2023-08-19 18:47:56 +02:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
|
2023-07-28 18:48:50 +02:00
|
|
|
mixin BlocLogger {
|
2023-06-18 16:26:19 +02:00
|
|
|
String? get tag => null;
|
|
|
|
|
|
|
|
bool Function(dynamic currentState, dynamic nextState)? get shouldLog => null;
|
2023-04-13 17:32:31 +02:00
|
|
|
}
|
2023-05-29 18:55:10 +02:00
|
|
|
|
|
|
|
/// Wrap around a string such that two strings with the same value will fail
|
|
|
|
/// the identical check
|
|
|
|
class StateMessage {
|
|
|
|
StateMessage(this.value);
|
|
|
|
|
|
|
|
final String value;
|
|
|
|
}
|
2023-08-19 18:47:56 +02:00
|
|
|
|
|
|
|
extension EmitterExtension<State> on Emitter<State> {
|
|
|
|
Future<void> forEachIgnoreError<T>(
|
|
|
|
Stream<T> stream, {
|
|
|
|
required State Function(T data) onData,
|
|
|
|
}) =>
|
|
|
|
onEach<T>(
|
|
|
|
stream,
|
|
|
|
onData: (data) => call(onData(data)),
|
|
|
|
onError: (_, __) {},
|
|
|
|
);
|
|
|
|
}
|