getLastClientId function

Future<String?> getLastClientId([
  1. String lastClientFilePath = './clonify/last_client.txt'
])

Retrieves the last used client ID from a file.

This function reads the last_client.txt file from the ./clonify/ directory to retrieve the last active client ID.

lastClientFilePath The path to the file storing the last client ID. Defaults to ./clonify/last_client.txt.

Note: This function is duplicated in clonify_core.dart. Consider refactoring.

Returns a Future<String?> which is the last saved client ID, or null if the file does not exist.

Throws a FileSystemException if the file exists but cannot be read.

Implementation

Future<String?> getLastClientId([
  String lastClientFilePath = './clonify/last_client.txt',
]) async {
  final file = File(lastClientFilePath);
  if (file.existsSync()) {
    return file.readAsStringSync();
  }
  return null;
}