latestVersionPath property

String latestVersionPath

Implementation

String get latestVersionPath {
  final dir = Directory(versionsDirectory);
  final fileList = dir.listSync();
  final versions = fileList
      .where((f) => f.path.endsWith('.map'))
      .map((f) => versionInFilePath(f.path))
      .toList();
  versions.sort((v1, v2) => int.parse(v1).compareTo(int.parse(v2)));
  final matched = fileList
      .where((element) => element.path.endsWith('.map'))
      .where((element) => versionInFilePath(element.path) == versions.last)
      .map((e) => e.path)
      .toList();
  return matched.isNotEmpty ? matched.first : '';
}