Mastering Clean Architecture & Repository Pattern in Flutter
David Serrano
Take your Flutter skills to the next level with this Flutter tutorial. Learn how to apply SOLID principles and manage data from a remote API with ease using the Repository Pattern and Clean Architecture framework. You'll come away with the tools to create cleaner, more scalable code that's easy to maintain and update in your own Flutter projects.
āŗ Support the channel:
Any donation is gratefully received, thank you!
- Via my website: https://davidserrano.io/sponsor
- Via YouTube's Super Thanks (Button labeled THANKS below the video:https://youtu.be/eEt6JrMuPZw)
š Subscribe:
Subscribe to my channel to see more videos like this!
š Useful resources:
- Remote API used in this tutorial: https://rapidapi.com/SAdrian/api/moviesdatabase/
- Quicktype (quickly convert JSON to Dart entities): https://app.quicktype.io/
- Open source project created in this video: https://github.com/svprdga/Flutter-Movies-App
š Flutter libraries used:
- In this tutorial, freezed is used to generate the domain models: https://pub.dev/packages/freezed
- Data models are autogenerated with json_serializable: https://pub.dev/packages/json_serializable
- The logger package is used to write to the log: https://pub.dev/packages/logger
- The provider package is used for dependency injection and state management: https://pub.dev/packages/provider
- Images are displayed and cached with the cached_network_image package: https://pub.dev/packages/cached_network_image
- Internationalization and language-related tools: https://pub.dev/packages/intl
- You can create an infinite scrollable list with infinite_scroll_pagination: https://pub.dev/packages/infinite_scroll_pagination
- We will use sqflite to work with a local database: https://pub.dev/packages/sqflite
šµ Follow me:
Find out about my latest videos and publications:
https://davidserrano.io/ https://twitter.com/svprdga https://hashnode.com/@svprdga https://dev.to/svprdga https://mastodon.social/@svprdga
ā³ Timecodes:
00:00 - Introduction 02:15 - Project setup & domain model creation with freezed 06:27 - Create the network entity models 08:07 - Map network entities to domain models 10:45 - Create the API client with dio 15:21 - Create the Movie Repository 19:13 - Load local configuration & setup dependency injection tree 26:10 - Create MoviePreview widget 30:26 - Infinite scrollable list with infinite_scroll_pagination 33:47 - Create the database entities 36:37 - Database mapper & Data Access Objects (DAO) 41:38 - Adjust the repository to work with the database 44:50 - Synchronize the local database with new data available in the API 50:34 - Dart analyze, Dart format, and final conclusion
2318866200 Bytes