You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
751B

  1. import 'package:rxdart/rxdart.dart';
  2. class LocalNotification {
  3. final String type;
  4. final String contents;
  5. final String tbCropId;
  6. LocalNotification(this.type, this.contents, this.tbCropId);
  7. }
  8. class NotificationsBloc {
  9. NotificationsBloc._internal();
  10. static final NotificationsBloc instance = NotificationsBloc._internal();
  11. final BehaviorSubject<LocalNotification> _notificationsStreamController =
  12. BehaviorSubject<LocalNotification>();
  13. Stream<LocalNotification> get notificationsStream {
  14. return _notificationsStreamController;
  15. }
  16. void newNotification(LocalNotification notification) {
  17. _notificationsStreamController.sink.add(notification);
  18. }
  19. void dispose() {
  20. _notificationsStreamController?.close();
  21. }
  22. }