Irbisa · Cheatsheet

Flutter System Design

The design round: feeds, chat, offline-first sync and conflicts, live updates, media, background uploads, server-driven UI

Senior Developer · 17 questions

  1. 01

    You get 45 minutes in a mobile system design round: what do you spend them on, and what is the interviewer actually scoring?

    Agree on scope and numbers first, draw the client's layers and the API they need, then spend most of the time on the one or two problems that make this product hard.

  2. 02

    Which mobile constraints do you raise in a design round (flaky network, process death, battery, old app versions), and how does each one change the design?

    A phone app runs on a network that drops, in a process the OS may kill at any moment, on a battery, and in versions you can no longer update.

  3. 03

    A Flutter home screen awaits five endpoints with Future.wait and shows nothing until all answer. What do you change in the app, and what do you ask the backend for?

    Stop waiting on all five together: give each section its own request and its own loading, error and data state, and paint from the local cache first.

  4. 04

    Polling, long polling, server-sent events, WebSockets or push: how do you choose the transport for live updates in a Flutter app?

    Pick by direction, frequency and app state: polling for data that changes every few minutes, SSE for a one-way stream, a WebSocket when both sides talk often, push to reach a closed app.

  5. 05

    How would you design an offline-first Flutter app: what the screens read, where a write goes with no network, and what the UI shows until the server confirms?

    Every screen renders from a local database it subscribes to, and network responses only ever land in that database.

    // The row and its pending operation commit together or not at all.Future<void> renameNote(Database db, String id, String title) {  final payload = jsonEncode({'title': title});  return db.transaction((txn) async {    await txn.rawUpdate(      "UPDATE notes SET title = ?, sync_state = 'pending' WHERE id = ?",…
  6. 06

    Two devices edit the same note offline and both sync later. How do you resolve the conflict (last write wins, field merge, CRDT), and what does each choice cost?

    Detect the conflict on the server by version, then use the cheapest rule the data allows: last write wins where losing one edit is acceptable, a three-way field merge for records, and a CRDT only for text or lists that people really edit together.

    typedef Fields = Map<String, Object?>; /// Three-way merge of one record with scalar fields: a field changed on one/// side only takes that side's value; changed differently on both, a conflict.(Fields merged, Set<String> conflicts) mergeRecord({  required Fields base, // the version both edits started from…
  7. 07

    A field-sales app must search a 50,000-product catalogue offline. How do you design the first download, the delta updates and the local search index?

    Ship the first copy as one prebuilt SQLite file instead of 50,000 JSON rows, keep it current with a feed of changes and tombstones since a server cursor, and search it through an FTS5 index in a bundled SQLite, off the UI isolate.

  8. 08

    Design the feed of an Instagram-like app in Flutter: API and pagination, local cache, image loading, and a smooth scroll that keeps its position after a restart.

    Page by a server cursor into a local table the list watches, build rows lazily with their height reserved from each image's aspect ratio, decode images at display size, and remember which post sat at the top of the screen, so a restart reopens at the same place.

  9. 09

    Design a TikTok-style vertical video feed in Flutter: preloading the next clips, a pool of players, memory limits, and what happens on a slow network.

    A vertical PageView.builder over a small pool of players: the current clip plays, the next one or two are initialised and buffered but paused, and everything further away is disposed.

  10. 10

    Design a messenger like Telegram in Flutter: the transport, message states (sending, sent, read), an offline send queue and paging through years of history.

    The chat screen watches a local database that one socket service outside the widget tree keeps filling.

  11. 11

    Design push notifications for a messenger: what the server sends, muting the push for the chat already open, grouping per chat, and clearing them once read elsewhere.

    The server decides who gets a push and shapes the payload per platform; the app draws chat notifications itself where it can, skips the chat that is on screen, keeps one notification per chat, and cancels it when another device reports the chat as read.

  12. 12

    Design live courier tracking on a map: how location updates reach the customer's app, how the marker moves smoothly, and what the screen shows when updates stop.

    The courier's app sends a fix every few seconds to the server, which fans it out over a socket while the customer's tracking screen is open, and through push and a lock-screen live notification when it is not.

  13. 13

    Design a photo backup feature that uploads thousands of photos in the background, survives the app being killed, and respects battery and mobile data.

    Keep the backup queue in your own database, one row per photo, and hand only a small window of uploads to the OS background transfer service, which keeps going while the app is suspended.

  14. 14

    Design daily reminders for a habit tracker: local notifications at the user's local time that survive time-zone changes, reboots and weeks without opening the app.

    Let the OS repeat them: zonedSchedule from flutter_local_notifications with DateTimeComponents.time fires daily with no app running.

    // Runs after tz.initializeTimeZones(). Store the returned zone: on launch and// resume, reschedule every reminder if the device zone has changed.Future<String> scheduleDaily(  FlutterLocalNotificationsPlugin plugin, {  required int id,  required int hour,…
  15. 15

    A trading screen gets thousands of price updates a second for 500 instruments. How do you design the pipeline from socket to widgets so the UI stays at 60 fps?

    Cut the volume at every stage: subscribe only to the instruments on screen, decode in a long-lived background isolate, keep only the latest tick per instrument, and push into per-row notifiers at most ten times a second, so a tick repaints one row and never the list.

    typedef Quote = ({String symbol, double price}); /// Thousands of ticks a second in, at most ten updates a second per row out.class QuoteBoard {  QuoteBoard(Stream<List<Quote>> batches) {    // a newer tick replaces one that nobody has seen yet…
  16. 16

    How would you build analytics and logging into a large Flutter app so events survive offline, respect consent, and the vendor can change without touching feature code?

    Feature code talks only to your own typed Analytics class, which returns at once and can never crash the caller; it stamps context, checks consent and buffers to disk.

  17. 17

    Product wants to rearrange the home screen without a store release. When does server-driven UI pay off in Flutter, how do you build it, and where does it backfire?

    It pays off on screens whose layout changes every week while the building blocks stay the same: a storefront home, campaign pages, onboarding.