syncToBackpack method

Future<bool> syncToBackpack()

Attempt to login a user using a storageKey.

Implementation

Future<bool> syncToBackpack() async {
  if (_key == null) {
    NyLogger.error(
        'The storageKey is not defined for ${runtimeType.toString()}. Please define a storageKey for this model.');
    return false;
  }

  dynamic authUser = await NyStorage.read<T>(_key!);
  if (authUser != null) {
    Backpack.instance.save(_key!, authUser);
    return true;
  }
  return false;
}