11import 'dart:io' ;
22
3+ import 'package:flutter/foundation.dart' ;
34import 'package:node_auth/data/exception/local_data_source_exception.dart' ;
45import 'package:node_auth/data/exception/remote_data_source_exception.dart' ;
56import 'package:node_auth/data/local/entities/user_and_token_entity.dart' ;
@@ -38,13 +39,13 @@ class UserRepositoryImpl implements UserRepository {
3839 .map (_Mappers .userAndTokenEntityToDomainAuthState)
3940 .onErrorReturn (UnauthenticatedState ())
4041 .publishValue ()
41- ..listen ((state) => print ('[USER_REPOSITORY] state=$state ' ))
42+ ..listen ((state) => debugPrint ('[USER_REPOSITORY] state=$state ' ))
4243 ..connect () {
4344 _init ();
4445 }
4546
4647 @override
47- Single_Result_Unit login ({
48+ UnitResultSingle login ({
4849 required String email,
4950 required String password,
5051 }) {
@@ -69,7 +70,7 @@ class UserRepositoryImpl implements UserRepository {
6970 }
7071
7172 @override
72- Single_Result_Unit registerUser ({
73+ UnitResultSingle registerUser ({
7374 required String name,
7475 required String email,
7576 required String password,
@@ -78,11 +79,11 @@ class UserRepositoryImpl implements UserRepository {
7879 .asUnit ();
7980
8081 @override
81- Single_Result_Unit logout () =>
82+ UnitResultSingle logout () =>
8283 _execute <void >(() => _localDataSource.removeUserAndToken ()).asUnit ();
8384
8485 @override
85- Single_Result_Unit uploadImage (File image) {
86+ UnitResultSingle uploadImage (File image) {
8687 return _userAndToken
8788 .flatMapResult ((userAndToken) {
8889 if (userAndToken == null ) {
@@ -118,7 +119,7 @@ class UserRepositoryImpl implements UserRepository {
118119 }
119120
120121 @override
121- Single_Result_Unit changePassword ({
122+ UnitResultSingle changePassword ({
122123 required String password,
123124 required String newPassword,
124125 }) {
@@ -144,7 +145,7 @@ class UserRepositoryImpl implements UserRepository {
144145 }
145146
146147 @override
147- Single_Result_Unit resetPassword ({
148+ UnitResultSingle resetPassword ({
148149 required String email,
149150 required String token,
150151 required String newPassword,
@@ -158,7 +159,7 @@ class UserRepositoryImpl implements UserRepository {
158159 ).asUnit ();
159160
160161 @override
161- Single_Result_Unit sendResetPasswordEmail (String email) =>
162+ UnitResultSingle sendResetPasswordEmail (String email) =>
162163 _execute (() => _remoteDataSource.resetPassword (email)).asUnit ();
163164
164165 ///
@@ -185,7 +186,7 @@ class UserRepositoryImpl implements UserRepository {
185186 void _handleUnauthenticatedError (Object e, StackTrace ? s) {
186187 if (e is RemoteDataSourceException &&
187188 e.statusCode == HttpStatus .unauthorized) {
188- print (
189+ debugPrint (
189190 '[USER_REPOSITORY] {interceptor} 401 - unauthenticated error ===> login again' );
190191 _localDataSource.removeUserAndToken ();
191192 }
@@ -212,7 +213,7 @@ class UserRepositoryImpl implements UserRepository {
212213
213214 try {
214215 final userAndToken = await _localDataSource.userAndToken;
215- print ('$tag userAndToken local=$userAndToken ' );
216+ debugPrint ('$tag userAndToken local=$userAndToken ' );
216217
217218 if (userAndToken == null ) {
218219 return ;
@@ -222,22 +223,22 @@ class UserRepositoryImpl implements UserRepository {
222223 userAndToken.user.email,
223224 userAndToken.token,
224225 );
225- print ('$tag userProfile server=$userProfile ' );
226+ debugPrint ('$tag userProfile server=$userProfile ' );
226227 await _localDataSource.saveUserAndToken (
227228 _Mappers .userResponseToUserAndTokenEntity (
228229 userProfile,
229230 userAndToken.token,
230231 ),
231232 );
232233 } on RemoteDataSourceException catch (e) {
233- print ('$tag remote error=$e ' );
234+ debugPrint ('$tag remote error=$e ' );
234235
235236 if (e.statusCode == HttpStatus .unauthorized) {
236- print ('$tag 401 - unauthenticated error ===> login again' );
237+ debugPrint ('$tag 401 - unauthenticated error ===> login again' );
237238 await _localDataSource.removeUserAndToken ();
238239 }
239240 } on LocalDataSourceException catch (e) {
240- print ('$tag local error=$e ' );
241+ debugPrint ('$tag local error=$e ' );
241242 await _localDataSource.removeUserAndToken ();
242243 }
243244 }
0 commit comments