Replies: 2 comments
-
I saw this, so this should not be a good practice. What would be the solution of such case?
|
Beta Was this translation helpful? Give feedback.
0 replies
-
So currently I am doing like this and it is working, @Riverpod(dependencies: [])
User initialForm(InitialFormRef ref) => throw UnimplementedError();
@Riverpod(dependencies: [initialForm])
class UpdateProfileController extends _$UpdateProfileController {
@override
UpdateProfileState build() {
final user = ref.watch(initialFormProvider);
return UpdateProfileState(
form: ProfileForm(
firstName: user.firstName,
lastName: user.lastName,
address: user.address,
image: user.image,
),
);
}
} class UpdateProfilePage extends StatelessWidget {
const UpdateProfilePage(this.user, {super.key});
final User user;
@override
Widget build(BuildContext context) {
return ProviderScope(
child: const UpdateProfileScaffold(),
overrides: [
initialFormProvider.overrideWithValue(
const User(id: 'id', firstName: 'Sangam'),
),
],
);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need both notifier and state of a Family Provider. Is this okay to do like this or there is a better approach?
Here
user
is provided as initial value for the form controller.Beta Was this translation helpful? Give feedback.
All reactions