34 lines
885 B
Dart
34 lines
885 B
Dart
|
|
import 'package:fcs/fcs/common/domain/entities/connectivity.dart';
|
||
|
|
import 'package:fcs/fcs/common/domain/entities/user.dart';
|
||
|
|
import 'package:fcs/fcs/common/domain/exceiptions/server_exceptions.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
|
||
|
|
import 'user_interface.dart';
|
||
|
|
|
||
|
|
class UserImp implements UserInterface {
|
||
|
|
UserImp({
|
||
|
|
@required this.connectivity,
|
||
|
|
});
|
||
|
|
|
||
|
|
final Connectivity connectivity;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Future<User> getUser(String id) async {
|
||
|
|
if (connectivity.isConnected) {
|
||
|
|
try {
|
||
|
|
final User user = User();
|
||
|
|
// await userFBDataProvider.getUser(id);
|
||
|
|
// cache product
|
||
|
|
// productLocalDataProvider.cacheProduct(product);
|
||
|
|
return user;
|
||
|
|
} catch (e) {
|
||
|
|
print(e);
|
||
|
|
return ServerException()();
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
return Future.value(User());
|
||
|
|
// return userLocalDataProvider.getUser(id);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|