askForLoadPath static method

Future<List<(String, String)>> askForLoadPath()

Récupère les fichiers .mbsave présents dans le répertoire de sauvegarde.

Retourne une liste de tuples (chemin complet, nom du fichier)

Implementation

static Future<List<(String,String)>> askForLoadPath() async {
  final result = (await pp.getApplicationDocumentsDirectory()).path;
  Directory saveFolder = Directory(result);
  List<FileSystemEntity> path = saveFolder.listSync();
  List<(String,String)> saves = [];
  saves = path.map((e) => ((e.path,e.path.split(Platform.isWindows ?  "\\":"/").last))).toList();
  saves = saves.where((e) => (e.$1.split(Platform.isWindows ?  "\\":"/").last.split(".").last == "mbsave") && (e.$2.split(".").last == "mbsave")).toList();
  return saves;
}