LCOV - code coverage report
Current view: | top level - src/models/organizers/organizer_helper - folder_helper.dart (source / functions) |  |  | Hit | Total | Coverage
Test: | lcov.info |  | Lines: | 17 | 17 | 100.0 %
Date: | 2021-10-11 06:57:03 |  | Functions: | 0 | 0 | -

              Line data    Source code
           1             : import 'package:widgetbook/widgetbook.dart';
           2             :
           3             : /// Helper to navigate the folder tree.
           4             : class FolderHelper {
           5           1 :   static List<Folder> getAllFoldersFromCategories(List<Category> categories) {
           6           1 :     final folders = <Folder>[];
           7           2 :     for (final category in categories) {
           8           1 :       folders.addAll(
           9           1 :         getAllFoldersFromCategory(category),
          10             :       );
          11             :     }
          12             :     return folders;
          13             :   }
          14             :
          15           1 :   static List<Folder> getAllFoldersFromCategory(Category category) {
          16           2 :     return getAllFoldersFromFolders(category.folders);
          17             :   }
          18             :
          19           1 :   static List<Folder> getAllFoldersFromFolders(List<Folder> folders) {
          20           1 :     final folderList = <Folder>[];
          21           2 :     for (final folder in folders) {
          22           1 :       folderList.addAll(
          23           1 :         getAllFoldersFromFolder(folder),
          24             :       );
          25             :     }
          26             :     return folderList;
          27             :   }
          28             :
          29           1 :   static List<Folder> getAllFoldersFromFolder(Folder folder) {
          30           1 :     final folderList = List<Folder>.from(
          31           1 :       <Folder>[folder],
          32           1 :     )..addAll(
          33           2 :         getAllFoldersFromFolders(folder.folders),
          34             :       );
          35             :     return folderList;
          36             :   }
          37             : }

Generated by: LCOV version 1.15