getAssetPaths function

Future<List<String>> getAssetPaths()

Function to get paths of files in the 'assets' directory and its subdirectories.

Implementation

Future<List<String>> getAssetPaths() async {
  List<String> toReturn = [];

  await for (var entity in Directory('assets').list(recursive: true)) {
    if (entity is File) {
      if (!entity.path.split(Platform.pathSeparator).last.startsWith('.')) {
        if (entity.path.split('.').last != 'ttf') {
          toReturn.add(entity.path);
        }
      }
    }
  }

  return toReturn;
}