saveToLocation static method

Future<void> saveToLocation(
  1. Token token,
  2. Directory directory,
  3. String? filename
)

Implementation

static Future<void> saveToLocation(
    Token token, Directory directory, String? filename) async {
  var file = File(directory.path + (filename ?? 'userData.json'));
  if (!(await file.exists())) {
    await file.create(recursive: true);
  }
  await file.writeAsString(jsonEncode(token));
}