Challenge: Dependency Injection
Test your understanding of state management in Flutter by dependency injection using the GetX library.
We'll cover the following
- Goal
- Specs
- Starter code
- Challenges
- Challenge 1: Add the Get package
- Challenge 2: Create the CartController class
- Challenge 3: Provide the CartController class and display the number of cart items
- Challenge 4: Display the list of items in the cart and the cart total
- Challenge 5: Remove items in the cart when the user dismisses them
- Challenge 6: Add products to the shopping cart
Goal
The goals of this challenge include:
- Learning to implement dependency injection.
- Using the GetX package to manage the state in your mobile app.
Specs
- When the user adds an item to the cart, it is added to the cart.
- Users should be able to remove items from the cart.
- The user interface should react to changes to the cart.
Starter code
Before beginning the challenge, look at the starter code below and run it. Once done, you can dive into the challenges below.
Get hands-on with 1400+ tech skills courses.