provider_group_generator 1.0.0+2
provider_group_generator: ^1.0.0+2 copied to clipboard
Generates static classes that aggregate annotated Riverpod providers for easy access and organization. Use with provider_group_annotation.
// ignore_for_file: uri_has_not_been_generated, override_on_non_overriding_member
import 'package:provider_group_annotation/provider_group_annotation.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'main.g.dart';
/// When includeAnyProviders: true on provider_group.yaml, generated file will contain this variable
/// The default value of includeAnyProviders is true.
/// ```dart
/// abstract final class AllProviders {
/// static const nonAnnotatedProvider = p0.nonAnnotatedProvider;
/// }
/// ```
@riverpod
String nonAnnotated(_) => '';
/// When includeNonProviders: true on provider_group.yaml, generated file will contain this variable.
/// The default value of includeNonProviders is false.
/// ```dart
/// class AllProviders {
/// static const annotatedProvider = 'Hello world';
/// }
/// ```
@providerGroup
const annotatedButNotProvider = '';
/// Any variable or class that is not annotated with `@riverpod` or `@providerGroup` will not be included in the generated file.
// ignore: specify_nonobvious_property_types, unused_element
final _nonAnnotatedHandWriting = Provider((_) => '');
/// you can change grouped class name ProviderGroup.groupName
/// ```dart
/// abstract final class HelloGroup {
/// static final annotatedHandWritingProvider = p0.annotatedHandWritingProvider;
/// }
/// ```
@ProviderGroup(groupName: 'HelloGroup')
// ignore: specify_nonobvious_property_types
final annotatedHandWriting = Provider((_) => 'Hello world');
/// This class is annotated with `@riverpod` and will be generated as a provider.
/// When includeAnyProviders: false on provider_group.yaml, you need to annotate this class with `@providerGroup` to include it in the generated file.
@riverpod
class RiverpodClass extends _$RiverpodClass {
@override
String build() => '';
}