getUserId method

Future<String> getUserId()

Implementation

Future<String> getUserId() async {
  final prefs = await SharedPreferences.getInstance();

  String? userId = prefs.getString('userId');

  if (userId != null) {
    return userId;
  }

  userId = const Uuid().v4();
  await prefs.setString('userId', userId);

  return userId;
}