riverpod_stateful_service_generator 6.0.1 copy "riverpod_stateful_service_generator: ^6.0.1" to clipboard
riverpod_stateful_service_generator: ^6.0.1 copied to clipboard

This package provides a lightweight stateful_service wrapper for Riverpod using code generation. See the stateful_service package for more information.

pub package popularity likes pub points building

Getting started #

This package provides a riverpod code generator for the stateful_service package, which allows you to easily create Riverpod providers for your StatefulService instances.

See the stateful_service package documentation for more information on how to get started.

Once you have a StatefulService, you can easily create a Riverpod notifier provider for it using an annotation:

part 'user_service.g.dart';
part 'user_service.stateful_service.dart';

@riverpodService
class UserService extends StatefulService<User> {
  ...
}

You can then use the provider as you would any other Riverpod provider:

Widget build(BuildContext context, WidgetRef ref) {
  final user = ref.watch(userServiceProvider);
  ...
}

You can also access the service directly using the included Provider extension, e.g:

Widget build(BuildContext context, WidgetRef ref) {
  final userService = ref.watch(userServiceProvider.service);
  ...
}
0
likes
150
points
684
downloads

Publisher

verified publisherwolverinebeach.net

Weekly Downloads

This package provides a lightweight stateful_service wrapper for Riverpod using code generation. See the stateful_service package for more information.

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

analyzer, build, build_config, collection, meta, path, riverpod_annotation, riverpod_stateful_service_annotation, source_gen

More

Packages that depend on riverpod_stateful_service_generator