orderEnvFiles method

List<FileSystemEntity> orderEnvFiles(
  1. List<FileSystemEntity> files
)

Implementation

List<FileSystemEntity> orderEnvFiles(List<FileSystemEntity> files) {
  files.sort((a, b) {
    final orderMap = {'.env.prod': 1, '.env.dev': 2, '.env': 3};
    final aOrder = orderMap[a.uri.pathSegments.last] ?? 4;
    final bOrder = orderMap[b.uri.pathSegments.last] ?? 4;

    return aOrder.compareTo(bOrder);
  });

  return files;
}