<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jantrah Tech</title>
    <description>The latest articles on DEV Community by Jantrah Tech (@jantrah_tech_2fcb4ee943d6).</description>
    <link>https://dev.to/jantrah_tech_2fcb4ee943d6</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4225528%2F105a1d60-e270-4aac-b85d-42289919d1db.png</url>
      <title>DEV Community: Jantrah Tech</title>
      <link>https://dev.to/jantrah_tech_2fcb4ee943d6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jantrah_tech_2fcb4ee943d6"/>
    <language>en</language>
    <item>
      <title>Offline-first retail POS: conflict resolution that survives patchy connectivity</title>
      <dc:creator>Jantrah Tech</dc:creator>
      <pubDate>Thu, 05 Nov 2026 11:37:08 +0000</pubDate>
      <link>https://dev.to/jantrah_tech_2fcb4ee943d6/offline-first-retail-pos-conflict-resolution-that-survives-patchy-connectivity-3gbi</link>
      <guid>https://dev.to/jantrah_tech_2fcb4ee943d6/offline-first-retail-pos-conflict-resolution-that-survives-patchy-connectivity-3gbi</guid>
      <description>&lt;p&gt;A retail counter does not get to assume the internet is up. The card network blips, the DSL drops, a staff member knocks the router — and the queue does not care. If your point-of-sale app freezes every time connectivity wobbles, you lose sales and you lose the cashier's trust. While building a &lt;a href="https://jantrah.com/jpos-retail-pos-software" rel="noopener noreferrer"&gt;retail POS&lt;/a&gt; that had to keep selling through dropouts, we settled on a handful of rules that kept the data sane once the connection came back.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: two tills, one network drop
&lt;/h2&gt;

&lt;p&gt;Picture two tills in the same shop. The network drops for ninety seconds. Both keep selling against their local copy of stock. When they reconnect, they each try to push their version of "what happened." Naive last-write-wins throws away real sales. A blocking "wait for the server" approach stops the shop. You need something in between: keep selling locally, then merge deterministically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 1: make every sale idempotent
&lt;/h2&gt;

&lt;p&gt;Generate the transaction ID on the client, not the server. A UUID minted at the till means a sale can be retried any number of times without being counted twice. The server treats an incoming ID it has already seen as a no-op and returns the stored result. This one decision removes a whole category of "the payment went through but the app resent it" bugs, and it makes your sync endpoint safe to call aggressively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 2: treat stock as events, not absolute counts
&lt;/h2&gt;

&lt;p&gt;Do not sync the number &lt;code&gt;42&lt;/code&gt;. Sync the events that produced it: &lt;code&gt;sold 3&lt;/code&gt;, &lt;code&gt;received 10&lt;/code&gt;, &lt;code&gt;adjusted -1&lt;/code&gt;. Absolute counts from two offline tills overwrite each other; append-only events from two tills simply interleave. The current quantity becomes a reduction over the event log, which also gives you a free audit trail — useful when an owner asks why the count moved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 3: resolve the few real conflicts deliberately
&lt;/h2&gt;

&lt;p&gt;Most "conflicts" disappear once stock is event-based, because addition is commutative. What remains are genuine business decisions: two tills sell the last unit of an item. That is not a data problem you can merge away with &lt;a href="https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type" rel="noopener noreferrer"&gt;conflict-free replicated data types&lt;/a&gt; alone — it is a policy. We let both sales stand, flag the item as oversold, and surface it for the manager, because in practice a quick restock or refund beats blocking the sale at the counter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we would not do again
&lt;/h2&gt;

&lt;p&gt;Early on we tried to keep a live socket open and "just reconnect." It made the happy path feel instant and the unhappy path impossible to reason about. Offline-first — local write, queue, reconcile — turned out to be simpler to build and far easier to explain to the people who actually stand at the till. If connectivity is unreliable where your software runs, design for the drop first and treat the online case as the optimisation, not the other way round.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>database</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Offline-first Flutter apps for field staff: five decisions that matter early</title>
      <dc:creator>Jantrah Tech</dc:creator>
      <pubDate>Wed, 04 Nov 2026 14:05:38 +0000</pubDate>
      <link>https://dev.to/jantrah_tech_2fcb4ee943d6/offline-first-flutter-apps-for-field-staff-five-decisions-that-matter-early-51cj</link>
      <guid>https://dev.to/jantrah_tech_2fcb4ee943d6/offline-first-flutter-apps-for-field-staff-five-decisions-that-matter-early-51cj</guid>
      <description>&lt;p&gt;Field staff apps (delivery riders, sales reps, technicians) spend a lot of time with poor or no connectivity. If the app assumes a network, staff stop trusting it and go back to paper. These are the five decisions we now make on day one when building this kind of app.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Treat the local database as the source of truth
&lt;/h2&gt;

&lt;p&gt;The UI reads and writes only to the on-device database (SQLite through drift, or Isar). The network is a background sync concern, not something a screen waits on. This one rule removes most "spinner forever" bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Give every record a client-generated ID
&lt;/h2&gt;

&lt;p&gt;Use UUIDs created on the device, not auto-increment IDs from the server. A record created offline then needs no ID remapping when it syncs, and related records (an order and its line items) can be created together without a round trip.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Queue changes, don't sync tables
&lt;/h2&gt;

&lt;p&gt;Store each change as an entry in an outbox table: what changed, when and by whom. A background worker pushes the queue in order when the connection returns, and marks entries done only after the server confirms. Retrying a queue is far easier to reason about than diffing whole tables.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Decide conflict rules before you write code
&lt;/h2&gt;

&lt;p&gt;Two people editing the same customer offline will happen. Pick a rule per entity: last write wins for notes, server wins for prices and stock, and "flag for review" for anything involving money. Write these rules down where the whole team can see them.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Show sync state honestly
&lt;/h2&gt;

&lt;p&gt;A small indicator such as "3 changes waiting to sync" does more for trust than any amount of polish. Staff need to know whether the office can see what they just entered.&lt;/p&gt;

&lt;p&gt;None of this is specific to Flutter, but a single codebase makes it practical to get it right once for both Android and iOS. If you are planning an app like this for your own team, the &lt;a href="https://jantrah.com/mobile-application-development" rel="noopener noreferrer"&gt;mobile app development team at Jantrah Tech&lt;/a&gt; works on exactly these problems.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>mobile</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
