Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add edit delete user - Using Riverpod #3

Open
wants to merge 3 commits into
base: assignment-part2
Choose a base branch
from

Conversation

adityazanzane-coditas
Copy link
Owner

@adityazanzane-coditas adityazanzane-coditas commented Mar 28, 2024

Description

Converted the user management functionality from Provider to Riverpod in the following files:

  • user_riverpod.dart: Implemented the UserProvider class using Riverpod's StateNotifierProvider.
  • user_list_screen.dart: Refactored the UserListScreen widget to use Riverpod's ConsumerWidget instead of ChangeNotifierProvider.
  • user_riverpod.dart: Reimplemented the UserProvider class using Riverpod's StateNotifierProvider. Updated the addUser, updateUser, and deleteUser methods to modify the state using Riverpod's state management approach.
  • Updated the main.dart file to use ProviderScope from Riverpod instead of ChangeNotifierProvider.

Screenshot

Screenshot 2024-03-29 at 8 33 53 AM Screenshot 2024-03-29 at 8 34 10 AM

PR Checklist

  • Build success
  • Tested

@@ -11,6 +11,7 @@ class UserEditScreen extends StatefulWidget {
final UserEditData userEditData;

@override
// ignore: library_private_types_in_public_api

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the need of this?

]);

void addUser(User newUser) {
state = [...state, newUser];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using ... ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants