update method

  1. @override
Future<bool> update(
  1. Map<String, dynamic> data
)
override

Implementation

@override
Future<bool> update(Map<String, dynamic> data) async {
  if (data.isEmpty) return false;
  try {
    return cache.then((local) {
      if (local != null && local.isLoggedIn && local.id.isNotEmpty) {
        return onUpdateUser(local.id, data).then((_) {
          return onFetchUser(local.id).then((value) {
            return repository.set(value);
          });
        });
      } else {
        return false;
      }
    });
  } catch (_) {
    return false;
  }
}