4
2
Fork 0

refactor: move factory constructor to the top

v0.1-dev
shihern 2020-01-27 21:00:12 +08:00
parent 197e597815
commit 793e57cd66
1 changed files with 4 additions and 4 deletions

View File

@ -14,6 +14,10 @@ class ConnectionStatus {
/// Stream of current connection status. Only updates when there is a change in connection.
Stream<bool> get connectionChange => _connectionChangeController.stream;
factory ConnectionStatus() {
return _singleton;
}
/// Private internal constructor for the Singleton
ConnectionStatus._internal() {
// Only call the init function when there is a subscriber to the stream
@ -60,8 +64,4 @@ class ConnectionStatus {
void dispose() {
_connectionChangeController.close();
}
factory ConnectionStatus() {
return _singleton;
}
}