allTags function

  1. @Riverpod(dependencies: [components])
Set<String> allTags(
  1. Ref ref
)

Implementation

@Riverpod(dependencies: [components])
Set<String> allTags(Ref ref) {
  final tags = {...ref.watch(globalTagsProvider)};
  final components = ref.watch(componentsProvider);
  for (final element in components) {
    switch (element) {
      case Component component:
        tags.addAll(
          component.meta.tags.map(
            (e) => e.replaceAll(RegExp('^!'), ''),
          ),
        );

        for (final story in component.stories) {
          tags.addAll(
            story.tags.map(
              (e) => e.replaceAll(RegExp('^!'), ''),
            ),
          );
        }
    }
  }

  return tags;
}