MODULES / 05 · DART & FLUTTER

Local persistence

Prerequisites

Modules 1 through 4.

Learning objectives

Persist data, reconstruct state after restarting and handle changes to the stored format.

Suggested activity

Create a record, close the application and open it again. Document the storage mechanism actually used by the current version.

SQLite, Sembast and Hive appear in historical article titles. The current README and code determine the storage mechanism and platform compatibility. Use the current version of the chosen repository, synthetic data and its documented validation steps. Record the environment and distinguish real execution, emulation and a local demonstration. These activities are proposals for your own study repository.

Suggested reading

Masmorra ASCII and A Agência Holística de Depuração: compare persistence and failure investigation with the chosen application.

Agência Holística · Volume II — Tudo Tem Memória: Compare displayed state with stored state and record how to detect an inconsistency.

Agência Holística · Volume III — A Conta Que Ficou: Connect the reading to a restoration test: recover a sample and check its data, rather than only the existence of a file.

Books & sites

Case studies and references

Labs for this module

These activities connect each laboratory to the lesson. Integration suggestions are adaptations for your own project.

Apply in your course project

Neural Engine

Follow the package persistence example to save a model as JSON and restore it through the lesson application’s local storage.

What to check: Compare predictions before and after restoration on the same inputs and handle an incompatible document without falsely reporting success.

Apply in your course project

Reinforcement Engine

Save and restore learning state using the documented checkpoint format, keeping storage outside the agent core.

What to check: Check values or evaluation of a fixed policy after restoring. Do not assume the training random sequence will be identical.

Explore the laboratories

05 / EXERCISES

Exercises

  1. 01

    Reopening

    Objective: Preserve a record between sessions.

    Completion criteria: Demonstrate creation, restarting and reading the same content.

  2. 02

    Updating

    Objective: Edit and delete a record.

    Completion criteria: Keep the changes correct after reopening the application.

  3. 03

    The format

    Objective: Define behavior for invalid stored data.

    Completion criteria: Reproduce the case in a test and avoid silent data loss.

  4. 04

    Evolution

    Objective: Change the schema using an explicit strategy.

    Completion criteria: Keep a sample of the earlier format readable or apply a tested migration.

  5. 05

    Isolation

    Objective: Test the repository with temporary storage.

    Completion criteria: Ensure that two runs do not accidentally share data.