riverpod_stateful_service 2.0.1
riverpod_stateful_service: ^2.0.1 copied to clipboard
This package provides a lightweight stateful_service wrapper for Riverpod. See the stateful_service package for more information.
example/example.dart
import 'package:riverpod_stateful_service/riverpod_stateful_service.dart';
import 'package:stateful_service/stateful_service.dart';
class User {
const User({required this.name});
final String name;
}
class UserService extends StatefulService<User> {
UserService({required super.initialState});
/// Your code here...
}
final StatefulServiceNotifierProvider<UserService, User> userServiceProvider = StatefulServiceNotifierProvider((ref) {
return StatefulServiceNotifier(UserService(initialState: const User(name: 'John Doe')));
});