setToken function

Future<void> setToken(
  1. Map<String, dynamic> map
)

Stores the given token data in SharedPreferences.

The data is stored as a JSON-encoded string.

map - A map containing the token and its associated metadata.

Implementation

Future<void> setToken(Map<String, dynamic> map) async {
  SharedPreferences sp = await SharedPreferences.getInstance();
  var data = json.encode(map); // Convert the map to a JSON string.
  sp.setString(SharedPrefrenceStorage.token, data); // Save the token.
}