update<R> method

  1. @override
Future<Response<UserEntity>> update<R>(
  1. String id,
  2. Map<String, dynamic> data, {
  3. R? source(
    1. R parent
    )?,
})
override

Implementation

@override
Future<Response<UserEntity>> update<R>(
  String id,
  Map<String, dynamic> data, {
  R? Function(R parent)? source,
}) async {
  try {
    var response = await repository.update(id, data, source);
    if (response.isSuccessful) {
      final lr =
          await localDataRepository.update(data: UserEntity.from(data));
      return lr.isSuccessful ? response : response.copy(message: lr.error);
    }
    return response;
  } catch (_) {
    return Future.error("$_");
  }
}