You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fluffychat/lib/pangea/common/controllers/base_controller.dart

19 lines
338 B
Dart

import 'dart:async';
class BaseController<T> {
final StreamController<T> _stateListener = StreamController<T>();
late Stream<T> stateStream;
BaseController() {
stateStream = _stateListener.stream.asBroadcastStream();
}
dispose() {
_stateListener.close();
}
setState(T data) {
_stateListener.add(data);
}
}