For this experience, please begin by carefully reading all of the Readings associated with this module. This will give you an excellent overview of architectural considerations for mobile apps in general and Flutter apps in particular. The author presents a particular architecture, which he calls the “Riverpod Architecture”, and we will adopt that approach for this class.
To begin this process, the goal of this experience is to refactor your FTW code base to conform to the structure presented in Flutter Project Structure: Feature-first or layer first.
What you’ll notice is that the current AGC mockups (for example) basically implement a “layer-first” project structure. Presuming you followed this example, then your FTW app does as well.
So, you’ll want to change your app architecture to “feature first”. (If you somehow followed a feature-first strategy to begin with, then you’ll not have much to do for this experience!)
For an example of how this might look, see Flutter AGC Mockup 4. This app is functionally equivalent to Mockup 3, but the lib/ directory has been reorganized. Here’s an excerpt illustrating the basic structure:
lib/
app.dart
main.dart
features/
authentication/
chapter/
common/
:
user/
data/
user_providers.dart
domain/
user_db.dart
presentation/
user_avatar.dart
user_card_view.dart
users_view.dart
The basic idea is:
data/
directory (containing the Provider declaration),domain/
directory (containing the DB and entity classes), andpresentation/
directory (containing the various UI widgets associated with the feature)repository/
layer, since we don’t yet have a backend database.application
layer, since we do not need to multiple service paths to any entity.You will find the IntelliJ IDEA “Move File” command under the refactor menu to be very useful in this process! I suggest you only move file at a time.
In most cases, you are simply moving a file into a different directory. The exception is the Riverpod Provider declarations: they need to be extracted from the “DB” file and put into their own file in the data/ directory.
There is an annoying tendancy of Flutter to not let you create new subdirectories within the lib/ directory. To fix this, see this stackoverflow answer.
This is a difficult task to decompose into subtasks and accomplish in parallel. Instead, I suggest you:
By the date and time listed in the Schedule page, please upload the URL to your mockup to Laulima. Also, please indicate what you personally added to the mockup since the last submission.