fix: use correct behavior subject for stream session #204
| @ -16,6 +16,7 @@ | ||||
| 
 | ||||
| import 'dart:async'; | ||||
| 
 | ||||
| import 'package:rxdart/streams.dart'; | ||||
| import 'package:rxdart/subjects.dart'; | ||||
| import 'package:wyatt_authentication_bloc/src/domain/data_sources/local/authentication_session_data_source.dart'; | ||||
| import 'package:wyatt_authentication_bloc/src/domain/entities/auth_session.dart'; | ||||
| @ -28,7 +29,7 @@ class AuthenticationSessionDataSourceImpl<Data> | ||||
|   /// {@macro authentication_session_data_source_impl} | ||||
|   AuthenticationSessionDataSourceImpl(); | ||||
| 
 | ||||
|   final StreamController<AuthenticationSession<Data>> _sessionStream = | ||||
|   final BehaviorSubject<AuthenticationSession<Data>> _sessionStream = | ||||
|       BehaviorSubject(); | ||||
| 
 | ||||
|   @override | ||||
| @ -37,9 +38,10 @@ class AuthenticationSessionDataSourceImpl<Data> | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<AuthenticationSession<Data>> currentSession() => sessionStream().last; | ||||
|   Future<AuthenticationSession<Data>> currentSession() async => | ||||
|       _sessionStream.value; | ||||
| 
 | ||||
|   @override | ||||
|   Stream<AuthenticationSession<Data>> sessionStream() => | ||||
|       _sessionStream.stream.asBroadcastStream(); | ||||
|       _sessionStream.shareValue(); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user