getUserToken method

Future<String> getUserToken()

Implementation

Future<String> getUserToken() async {
  AndroidOptions _getAndroidOptions() => const AndroidOptions(
        encryptedSharedPreferences: true,
      );
  final storage = FlutterSecureStorage(aOptions: _getAndroidOptions());
  String? value = await storage.read(key: "device_public_token");
  if (value != null) {
    log("CommonInterface:[getUserToken]->$value");
    return value;
  }
  var uuid = Uuid();
  value = uuid.v4();
  await storage.write(key: "device_public_token", value: value);
  log("CommonInterface:[getUserToken]->$value");

  return value;
}