Offline-First Flutter Apps for Field Teams: Sync Design — Integrations & APIs article by Rui Codex

An offline-first Flutter app writes every change to a local database on the device first, queues it, and syncs with the server when a connection returns. Conflicts are resolved by agreed rules, such as field-level merges, version checks or a human review step, chosen per data type before the first release.

Key takeaways

  • An offline-first app makes the device the write path and the server a later destination for queued changes.
  • Use a transactional local database for business records and a simple key-value store only for settings and tokens.
  • Sync by pushing an outbox of idempotent operations and pulling deltas from a server cursor.
  • Decide a conflict rule for each field before release, rather than one global rule for every record.
  • Test long offline periods on real devices, because sync failures usually appear at the edges.

What does offline-first mean for a Flutter app?

An offline-first app treats the device as the place where work is saved, and treats the server as a destination that receives those changes later. The difference matters for field teams who inspect equipment in basements, lift shafts or rural sites where connectivity is unreliable or absent.

In a typical design, a user action updates the local store immediately, so the screen responds without waiting for a network call. The same action also adds an entry to an outbox, a local queue of operations that a background sync process sends when the device is online.

This is different from caching. A cache holds a copy of server data that can be discarded and fetched again. In an offline-first app, the local store holds unsent work, so deleting it means losing data. That is why failed uploads, retries and deletes need explicit handling from the start.

Tip: Write the outbox schema before the screens. Every entry should record the operation type, the record identifier, the base revision it was built on and a unique operation identifier.

Which local storage option fits field data?

Use a transactional database for business records that users filter, relate and edit, and a key-value store for settings, flags and authentication tokens. Mixing both is normal, because the outbox and the inspection records have different query and durability needs.

In Flutter, the sqflite package gives direct access to SQLite, and drift adds typed queries and migration tooling on top of SQLite. Both are reasonable choices. The decision usually depends on how much schema work your team wants to maintain as the app grows.

OptionStrengthWhere it fails
Key-value storeSimple to use for small valuesPoor for relational queries and large record sets
SQLite via sqfliteDirect control and transactionsHand-written SQL and manual migrations
SQLite via driftTyped queries and structured migrationsMore setup and a code generation step
Document storeFlexible record shapesWeak fit when reports need joins across records

Whichever store you choose, wrap each user action and its outbox entry in one transaction. If the app crashes between the two writes, the user either sees the change with a queued operation or sees no change at all.

How should sync be designed?

Sync works best as two flows: a push of queued operations and a pull of changes made elsewhere since the last synchronisation. Copying the whole database on each sync is simpler to build, but it wastes mobile data and fails badly as records grow.

  1. Give every record a client-generated identifier that stays stable after the first save.
  2. Record each change as an operation with its own unique identifier, so the server can ignore duplicates.
  3. Push the outbox in creation order, and remove an entry only after the server confirms it.
  4. Pull changes using a server cursor, so the device requests only what it has not yet seen.
  5. Apply pulled changes in one transaction, and do not overwrite unsent local edits without running the conflict rule.

Each step has a failure mode. Duplicate delivery happens when a response is lost after the server has accepted the write, which is why operation identifiers matter. Ordering breaks when the device clock is wrong, so the server should assign revision numbers rather than trusting timestamps from the phone.

Tip: Use exponential backoff for retries and cap the outbox size. A queue that grows for weeks is a storage and support problem, and it needs a visible warning to the user.

How do you resolve conflicts between devices?

Resolve conflicts with a rule chosen for each field before the first release. Last-write-wins is acceptable for low-stakes fields, merging suits lists and notes, and a person should review changes to signed or regulated records.

Conflicts appear when a device sends an update built on an old revision. The server compares the base revision with its current revision and flags the mismatch instead of silently replacing the data.

  • Last-write-wins: simple, but it discards the other edit without warning, and it depends on trustworthy clocks.
  • Field-level merge: keeps non-overlapping edits, but needs clear ownership of each field.
  • Manual review: safest for audit-sensitive data, but it slows field work and needs a review interface.
  • Deletes: use tombstones so a delete from one device is not undone by an old update from another.

Testing matters more than the rule itself. Simulate two devices editing the same record offline, then reconnect them in both orders and check the final state.

What about personal data on the device?

The General Data Protection Regulation applies to personal data processed by organisations in the EU, including data held temporarily on employees' devices. The regulation text is available on EUR-Lex at Regulation (EU) 2016/679 on EUR-Lex. This article is general information and not legal or tax advice.

Technically, that means deciding what personal data is stored offline, encrypting the local database where the platform and your design allow it, clearing data after a successful sync, and remotely revoking access when a device is lost. Rui Codex offers technical implementation support for these engineering decisions, but not legal, tax or compliance advice.

Hypothetical examples of field sync

Here are two hypothetical scenarios:

In the first, an inspector updates a checklist offline while an office colleague adds a note to the same checklist. Field-level merging keeps both changes because they touch different fields, and the server flags only the status field where both users edited the value.

In the second, a technician deletes a job offline while a supervisor uploads a photo to that job from another device. A tombstone keeps the deletion visible, so the photo upload is held for review rather than silently recreating the job.

Where does custom software fit in?

Offline-first behaviour usually needs custom work where the app must match a company's own forms, approval steps and back-office systems. Rui Codex is led by a founder with 200+ projects delivered, and its services cover custom software development and system integrations. Published case studies are available at Rui Codex case studies, and integration patterns for connected systems are described on the Rui Codex integrations page.

Sync logic also depends on the systems behind the app. If field records must reach an ERP or CRM, the integration design should be settled alongside the mobile design, as covered in the Rui Codex guides on system integration and API engineering.

Frequently Asked Questions

Should an offline-first Flutter app use SQLite for storage?

Often yes, when the app stores records that need filtering, relations and transactions. Packages such as sqflite and drift both build on SQLite, and the choice between them is mostly about how much typed query code and migration tooling your team wants. For settings, tokens and small flags, a key-value store is simpler. Decide per data type rather than adopting one store for everything, because the outbox and business records have different needs.

How often should a field app sync with the server?

There is no fixed interval that suits every field team. Most offline-first designs push the outbox when connectivity returns and when a user taps sync, then pull changes since the last server cursor. Retries should back off so a flaky connection does not drain the battery or the data plan. Measure how long devices stay offline in your own pilot before you choose any background schedule.

Can two people edit the same record while offline?

Yes, and the design must expect it. Each record carries a server revision, and an update based on an old revision is flagged rather than silently overwritten. The conflict rule then decides whether fields merge automatically, the latest change wins, or a person reviews the difference. Choose the rule for each field before release.

Is offline-first the same as caching API responses?

No. A cache is a read-side copy of server data that can be discarded and refetched. In an offline-first app, the local store is the write path: users save to the device first, and the server receives those changes later through a queue. That difference changes how you handle deletes, failed uploads and conflicts, so it should be a deliberate architecture choice.

Conclusion

Offline-first Flutter apps for field teams depend on three decisions made early: a transactional local store, an outbox of idempotent operations, and a conflict rule chosen field by field. Each choice has trade-offs, and each fails in predictable ways, such as lost deletes, duplicate uploads or silent overwrites. Test the design with two devices, long offline periods and reconnection in both orders before rollout. If you are planning a field app and want an engineering review of your sync design, Request a project consultation at https://ruicodex.com/Contact or email info@ruicodex.com to discuss your project.

Sources

Tags: Flutter Offline-first Mobile sync Local storage Conflict resolution SQLite Field service apps Custom software

Need Help Implementing This?

Our team can help you put these insights into practice. From AI automation to custom software development, we build solutions that deliver real results.

Send a project request