An example Flutter project that uses Riverpod, go_router, flutter_hooks, and Freezed.
Check out the experimental use of macros here.
This project uses DummyJSON API. Please note that DummyJSON doesn't apply your changes when creating, updating, or deleting items. This project correctly implements those actions, but expect no data changes due to these API limitations.
You can run the app with --dart-define=MOCK_API=true
flag to use the internal mocked API that mimics the original API behavior and does modify your changes in a session. If you're using VSCode, you can instead run the app with the "dummymart (mock API)" configuration.
Each feature demonstrates certain functionalities that are commonly used in a CRUD app.
- Products: Basic "view all items" and "view item details" functionalities. Also implements "pull-to-refresh" mechanism.
- Todos: Full CRUD operations, including "add item", "edit item", and "delete item".
- Posts: More advanced read operations such as "search as we type (with debounce)" and "infinite scrolling".
The auth and router services allow functionalities such as "invalidate all data on logout" and "redirect screens based on the auth state".
Full paths for routes:
=> /
=> /login
=> /settings
=> /products
=> /products/:id
=> /todos
=> /todos/add
=> /todos/:id
=> /todos/:id/update
=> /posts
=> /posts/:id
=> /profile
- Run
flutter pub get
to get dependencies. - Run
dart run build_runner build
to generate required files. You can also rundart run build_runner watch
to generate files and let build_runner watch for changes and rebuild if necessary. - (Optional) Run
dart run husky install
to setup git hooks on your machine.
Use these credentials to login:
username: avat
password: avatpass
Or you can use any user credentials from https://dummyjson.com/users.