An offline-first Flutter app keeps a useful part of its workflow available without a reliable internet connection. That usually means reading from local storage, saving eligible changes locally, and synchronizing them with a backend when possible. The difficult decisions concern what happens after a save: retries, conflicting edits, deleted records, expired sessions, and unfinished uploads.
Consider a field-service app where a technician opens assigned jobs and writes inspection notes. Losing connectivity should not erase an inspection. At the same time, the app should not pretend that a locally saved note has already reached the office. This illustrative workflow will guide the architecture below.
The goal is a delivery plan you can discuss with a Flutter developer or backend team. The SQL example demonstrates a local transaction; the surrounding design still needs implementation and device testing for your product.
Define exactly what works offline
Write an offline capability list before choosing a database. For each operation, decide whether the user can read previously downloaded information, create a draft, submit a change later, or must wait for a server response.
For the inspection app, I would initially allow viewing downloaded jobs and editing notes. Reassigning a job, confirming a payment, or granting another person access would remain server-controlled. A locally displayed payment status should include its freshness; it cannot prove a new payment succeeded.
Define the empty-cache experience too. A person installing the app for the first time without connectivity cannot read jobs that were never downloaded. Explain that state instead of showing an endless loading indicator.
Agree on the wording of each save state. Saved on this device, waiting to sync, synced, and needs attention describe different outcomes. This small interface decision prevents a larger support problem: users believing their colleagues can see information that has never left their phone.
Keep local and remote data behind a repository
Flutter's offline-first architecture guide places access to local and remote services behind a repository. That gives the rest of the application one interface instead of asking each screen to choose between an HTTP response and a database query.
For this design, the screen would observe local job records. A refresh task would fetch permitted server updates and write them into that same local store. The UI would then receive the updated records through its normal observation path. A failed refresh can leave useful existing data visible while reporting that it could not be refreshed.
Keep freshness metadata separate from content. Record when a refresh last succeeded, which account owns the data, and whether a record has pending local changes. Do not overwrite an unsent note just because a background read returned an older server copy.
Your state-management package can express these states, but it does not supply the synchronization policy. That is one reason to separate application rules from widgets whether you use BLoC or another approach.
Save the record and its queued operation together
A durable outbox is a local table containing operations that still need to reach the server. When the technician saves a note, write the note and its outbox entry in the same database transaction. Otherwise, a crash between the two writes can leave a visible draft that the synchronizer never discovers.
Flutter documents SQLite persistence for structured local data. SQLite's transaction documentation explains the transaction controls used in this minimal example:
PRAGMA foreign_keys = ON;
CREATE TABLE notes (
owner_id TEXT NOT NULL,
id TEXT NOT NULL,
body TEXT NOT NULL,
server_revision INTEGER,
PRIMARY KEY (owner_id, id)
);
CREATE TABLE outbox (
owner_id TEXT NOT NULL,
operation_id TEXT NOT NULL,
note_id TEXT NOT NULL,
payload TEXT NOT NULL,
base_revision INTEGER,
PRIMARY KEY (owner_id, operation_id),
FOREIGN KEY (owner_id, note_id)
REFERENCES notes(owner_id, id)
);
BEGIN TRANSACTION;
INSERT INTO notes VALUES ('account-a', 'note-17', 'Valve checked', NULL);
INSERT INTO outbox VALUES (
'account-a', 'operation-42', 'note-17',
'{"body":"Valve checked"}', NULL
);
COMMIT;These identifiers are illustrative. In an app, generate stable identifiers, bind SQL parameters, handle failures with a rollback, and manage schema migrations. The production outbox also needs retry scheduling and a worker claiming strategy if foreground and background workers can run concurrently.
The payload is a snapshot of this particular operation. Reading the latest note body later and attaching it to an older operation ID can accidentally change the meaning of a retried request. Decide whether later edits create new ordered operations or safely replace an operation that has never been sent.
Make synchronization safe to retry
A timeout creates uncertainty: the server may have saved the note even though the phone never received its response. Repeating the request must not create another inspection note.
For this workflow, I would send a stable operation ID and have the backend
persist its processing result with the corresponding change. A retry would
return the previous result. Reusing an ID with a different payload should be
rejected. The server must also authenticate the caller and check access to the
job; a local owner_id field is not authorization.
Only mark an operation complete after receiving and recording a confirmed result. Persist the canonical record and server revision at that point. If the app crashes before the local acknowledgement is saved, retrying the same operation should still be safe. This is related to the reasoning behind idempotent payment requests, although note synchronization has its own business rules.
Classify failures using your API contract. A temporary service failure can be retried with bounded exponential backoff and jitter. Rate limits should respect the server's retry guidance. Expired authentication should pause the account's queue while the user signs in again. A validation rejection needs an explanation or correction route, rather than an endless retry loop.
Choose a conflict policy for each kind of data
Suppose two devices download revision 8 of a note. Both edit it offline. The first device submits its edit and creates revision 9. The second device now holds an edit based on an older revision.
Android's offline-first guidance discusses versioning and conflict resolution. My proposed API would compare the submitted base revision with the current server revision and return a conflict when they differ. The client can then keep both versions available for review.
The right resolution depends on the record:
- An append-only inspection comment can become a separate entry with its own ID.
- An editable note may need a comparison screen and an explicit choice.
- A cosmetic preference may tolerate a documented last-write-wins policy.
- A stock allocation needs authoritative backend rules to prevent invalid totals.
Do not use a phone's clock as the sole authority for a business-critical merge. Different clocks and delayed synchronization make “the latest timestamp” a poor substitute for understanding which version was edited.
For a first release, reducing simultaneous editing may be more practical than building a sophisticated merge engine. Make that product constraint visible in the brief and explain what users should do when a conflict appears.
Handle deletions, attachments, and account changes
Deletion needs a synchronization story. If the server simply stops returning a record, the client may not know whether it was deleted or omitted from a page. Consider deletion markers or a change feed, with a retention and full-resync policy for devices that remain offline for a long time.
Treat photos as a separate workload. An inspection with ten large images needs storage limits, upload progress, cancellation, and recovery from interrupted uploads. Keep the text draft usable while attachments are waiting, and define whether submission requires every attachment to finish first.
Account switching is another boundary. Local records and queued operations must remain associated with their originating account. Never drain account A's queue using account B's session. On logout, decide whether to remove cached data, retain protected drafts, or ask the user to synchronize or discard unsent work. Sensitive local storage needs protection appropriate to the data and device policy.
Does Firestore remove the need for a sync design?
Firestore offline persistence can manage cached reads and synchronization for supported operations and platforms. Its documentation describes last-write-wins behaviour for multiple changes to the same document. That may fit some workflows and conflict with others.
Evaluate the exact operations you need before adding a second, custom queue around a managed client's existing queue. You still need clear pending-write feedback, account handling, validation, and a policy for conflicting business changes. A separate REST backend will need its own synchronization contract.
The database choice should follow those requirements. Choosing Firebase or SQLite first and discovering the conflict rules later can force expensive changes to both the app and the backend.
Plan for background work that may be delayed
An in-memory timer is not a durable scheduler. A process can be suspended or terminated, so the queue must survive without it. Apple's background task guidance also makes clear that the system controls when deferred work gets execution time.
I would provide a foreground synchronization path on app launch or resume, plus an explicit retry action. Add platform-appropriate background scheduling where useful, but do not promise a precise upload time while an app is closed. A connectivity change is a reason to attempt a request, not proof that the API is reachable or the user's session remains valid.
Test failures between steps
Airplane mode is only the first test. Exercise the transitions that can lose or duplicate work:
- Save a note, terminate the process, and confirm both draft and queue survive.
- Let the server commit, drop its response, and confirm the retry creates no duplicate.
- Edit the same record from two devices and verify the conflict experience.
- Expire the session, switch accounts, and confirm queues remain isolated.
- Delete a record remotely while another device has a pending edit.
- Interrupt a photo upload and resume without restarting the whole inspection.
- Run a database migration while unsent operations exist.
- Test an empty cache and a device returning after a long offline period.
Measure queued-operation age, failures by category, conflict frequency, and successful synchronization. Keep note bodies and other sensitive content out of routine telemetry. A low error count is not reassuring if a stuck queue has stopped attempting work.
Questions to settle before development
Can every feature work offline?
No. Decide which actions can be safely deferred and which need authoritative server decisions. A useful offline inspection flow does not require offline permission changes, payment confirmation, or guaranteed stock availability.
Is offline-first only useful with poor network coverage?
It also helps during temporary outages, network transitions, and slow connections. Its value depends on the cost of interrupting the user's work, balanced against the extra synchronization complexity.
What should a developer estimate include?
Include local storage, migrations, the server sync contract, retries, conflict screens, account transitions, attachments, and failure testing. A “cache the API response” estimate does not cover that delivery.
If your app needs this behaviour, my Flutter development services and backend services cover both sides of the workflow. Add the offline capability list to your MVP brief so the first release has a shared definition of what remains available when the connection disappears.



