28 lines
722 B
Dart
28 lines
722 B
Dart
/// Minimal stand-ins for the parts of flutter_bloc that pipe recognises, so the
|
|
/// fixture needs no dependencies. pipe identifies blocs by the `Bloc<...>` /
|
|
/// `Cubit<...>` supertype and by `emit(...)` call sites.
|
|
library;
|
|
|
|
abstract class Bloc<E, S> {
|
|
Bloc(S initial) : state = initial;
|
|
|
|
S state;
|
|
|
|
void emit(S next) {
|
|
state = next;
|
|
}
|
|
|
|
void add(E event) {}
|
|
|
|
void on<T extends E>(
|
|
void Function(T event, void Function(S next) emit) handler,
|
|
) {}
|
|
}
|
|
|
|
/// Minimal stand-in for flutter_bloc's BlocBuilder, so render-site extraction
|
|
/// can be exercised without Flutter.
|
|
class BlocBuilder<B, S> {
|
|
const BlocBuilder({required this.builder});
|
|
|
|
final Object Function(Object context, S state) builder;
|
|
}
|