getUsername method

Future<String?> getUsername()

Implementation

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

  // Retrieve the username
  String? username = prefs.getString('username');

  // Print whether the username was retrieved successfully
  /* if (username != null) {
     print("Retrieved username: $username");
  } else {
    print("No username found in SharedPreferences.");
  }
*/
  return username;
}