Created
August 9, 2019 19:24
-
-
Save bmelton/3a5c9a236bfed7dc3bbabfe00bf842d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:rxdart/rxdart.dart'; | |
class DateService { | |
static DateTime now = DateTime.now(); | |
static DateTime today = DateTime(now.year, now.month, now.day, 0, 0, 0, 0).toUtc(); | |
BehaviorSubject<DateTime> dateSubject = BehaviorSubject<DateTime>.seeded(today); | |
Stream<DateTime> get currentDate => dateSubject; | |
void broadcastDate(DateTime date) { | |
dateSubject.add(date); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment