Building a Todo/CRUD Application In Flutter With Redux - Part 2
Repository
https://github.com/flutter/flutter
What Will I Learn?
- You will learn about Redux Middleware
- You will learn how to use the Flutter Redux Dev Tools
- You will learn how to use modular design to expand a Redux application
- You will learn how to add actions which dispatch to and from middleware
- You will learn about the StoreBuilder Widget
Requirements
System Requirements:
- IDEA intellij, Visual Studio Code with the Dart/Flutter Plugins, Android Studio or Xcode
- The Flutter SDK on the latest Master Build
- An Android or iOS Emulator or device for testing
OS Support for Flutter:
- Windows 7 SP1 or later (64-bit)
- macOS (64-bit)
- Linux (64-bit)
Required Knowledge
- A basic knowledge of Redux
- A fair understanding of Mobile development and Imperative or Object Oriented Programming
- Basic knowledge of CRUD
Resources for Flutter and this Project:
- Flutter Website: https://flutter.io/
- Flutter Official Documentation: https://flutter.io/docs/
- Flutter Installation Information: https://flutter.io/get-started/install/
- Flutter GitHub repository: https://github.com/flutter/flutter
- Flutter Dart 2 Information: https://github.com/flutter/flutter/wiki/Trying-the-preview-of-Dart-2-in-Flutter
- Flutter Technical Overview: https://flutter.io/technical-overview/
- Dart Website: https://www.dartlang.org/
- Flutter Awesome GitHub Repository: https://github.com/Solido/awesome-flutter
Sources:
Flutter Logo (Google): https://flutter.io/
Difficulty
- Intermediate
Outline and Overview
In this Flutter Tutorial, we expand upon the last tutorial entry and take a look at how we can create side effects in a Redux application by using Middleware. The original application allows us to create items in a list and remove those items either one at a time or all at once. In this version of the application, we add functionality that allows us to save these entries into a shared preferences key-value store. This includes serializing and deserializing the data into JSON format to store and retrieve from the key-value store. To create this side effect we make use of middleware which sits between the user interface and the pure reducer functions. We also add the Redux Flutter developer tools so that we can see how all of this is working in real time and have the ability to walk backwards through the state changes.
Description
The Expanded Cycle of Redux
As we know from the last video, Redux follows a cycle when creating state changes. Actions are dispatched from the user interface to the pure reducer functions. These reducer functions then add new data to the store which then propagates changes back to the User interface. The missing element in this cycle of events is the ability to interface and interact with outside systems and events. Because the Reducers are pure functions, they are not allowed to create side effects. This prohibits our applications from reading from APIs and writing to Databases. This is where the Redux Middleware comes in.
In the image above, we have an amended graph of events that represents this new redux life cycle. By adding a step between where the actions are dispatched and the reducer functions we can keep our system pure and not sacrifice these types of functionalities. In this project, we demonstrate this by creating an action which is dispatched from the UI which then loads the data from a saved preferences key-value store and pushes that data into a reducer. The middleware almost acts like the UI in that it is also able to dispatch its own actions back to the reducers.
Time traveling through State using Redux Dev Tools
Because our Store is Immutable and our reducers are pure, the state changes in our application are predictable. The state changes only one way in accordance to a dispatched action and we can see how these actions were applied to the data in a series. This also allows us to make use of tools that are common in functional programming languages such as a time traveling debugger. A time traveling debugger allows us to step forward and backward through the state changes made by our application in real-time.
In the Flutter Redux econsystem, this time traveling Debugger comes in the form of the Flutter Redux Dev Tool library. This tool is extremely easy to implement and it allows us to look at our state in real time. Using this debugger we can also save the state in our application and transplant it to another instance of a similar or same application. As long as the Redux logic of the application is the same and the model of the application is similar, then we have the ability to re-create the state in this way.
The source code for this project can be found here
Video Tutorial
Related Videos
- Building a Todo/CRUD Application In Flutter With Redux - Part 1
- Building a List in Redux with Dart's Flutter Framework
Projects and Series
Stand Alone Projects:
- Dart Flutter Cross Platform Chat Application Tutorial
- Building a Temperature Conversion Application using Dart's Flutter Framework
- Managing State with Flutter Flux and Building a Crypto Tracker Application with Dart's Flutter Framework
Building a Calculator
- Building a Calculator Layout using Dart's Flutter Framework
- Finishing our Calculator Application with Dart's Flutter Framework
Movie Searcher Application
- Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 1)
- Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 2)
- Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 3, Final)
Minesweeper Game
- Building a Mine Sweeper Game using Dart's Flutter Framework (Part 1)
- Building a Mine Sweeper Game using Dart's Flutter Framework (Part 2)
- Building a Mine Sweeper Game using Dart's Flutter Framework (Part 3)
- Building a Mine Sweeper Game using Dart's Flutter Framework (Part 4, Final)
Weather Application
- Building a Weather Application with Dart's Flutter Framework (Part 1, Handling Complex JSON with Built Code Generation)
- Building a Weather Application with Dart's Flutter Framework (Part 2, Creating a Repository and Model)
- Building a Weather Application with Dart's Flutter Framework (Part 3, RxCommand (RxDart) and Adding an Inherited Widget)
- Building a Weather Application with Dart's Flutter Framework (Part 4, Using RxWidget to Build a Reactive User Interface)
- Localize and Internationalize Applications with Intl and the Flutter SDK in Dart's Flutter Framework
Curriculum
- Building a Multi-Page Application with Dart's Flutter Mobile Framework
- Making Http requests and Using Json in Dart's Flutter Framework
- Building Dynamic Lists with Streams in Dart's Flutter Framework
- Using GridView, Tabs, and Steppers in Dart's Flutter Framework
- Using Global Keys to get State and Validate Input in Dart's Flutter Framework
- The Basics of Animation with Dart's Flutter Framework
- Advanced Physics Based Animations in Dart's Flutter Framework
- Building a Drag and Drop Application with Dart's Flutter Framework
- Building a Hero Animation and an Application Drawer in Dart's Flutter Framework
- Using Inherited Widgets and Gesture Detectors in Dart's Flutter Framework
- Using Gradients, Fractional Offsets, Page Views and Other Widgets in Dart's Flutter Framework
- Making use of Shared Preferences, Flex Widgets and Dismissibles with Dart's Flutter framework
- Using the Different Style Widgets and Properties in Dart's Flutter Framework
- Composing Animations and Chaining Animations in Dart's Flutter Framework
- Building a Countdown Timer with a Custom Painter and Animations in Dart's Flutter Framework
- Reading and Writing Data and Files with Path Provider using Dart's Flutter Framework
- Exploring Webviews and the Url Launcher Plugin in Dart's Flutter Framework
- Adding a Real-time Database to a Flutter application with Firebase
- Managing State with the Scoped Model Pattern in Dart's Flutter Framework
- Authenticating Guest Users for Firebase using Dart's Flutter Framework
- How to Monetize Your Flutter Applications Using Admob
- Using Geolocator to Communicate with the GPS and Build a Map in Dart's Flutter Framework
- Managing the App Life Cycle and the Screen Orientation in Dart's Flutter Framework
- Making use of General Utility Libraries for Dart's Flutter Framework
- Interfacing with Websockets and Streams in Dart's Flutter Framework
- Playing Local, Network and YouTube Videos with the Video Player Plugin in Dart's Flutter Framework
- Building Custom Scroll Physics and Simulations with Dart's Flutter Framework
- Making Dynamic Layouts with Slivers in Dart's Flutter Framework
- Building a Sketch Application by using Custom Painters in Dart's Flutter Framework
- Using Dart Isolates, Dependency Injection and Future Builders in Dart's Flutter Framework
- Looking at the Main Features of the Beta Three Release of Dart's Flutter Framework
Great work @tensor. Very interesting series. I appreciate your thorough approach. Good work. Looking forward to the next piece.
Time travelling ;) Who knew
Bucky
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Thank you for your review, @buckydurddle!
So far this week you've reviewed 2 contributions. Keep up the good work!
Thanks again bucky. Always a pleasure to see your comments on my content.
Hey, @tensor!
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!