Blog

Seven Flutter apps, one shared core

How I stopped copying code between the Sooq apps and built one package they all stand on.

Sooq is a shopping and delivery platform with a customer app, a courier app, a store panel and a platform console — and later a wallet, an agent app and a wallet console. They all need the same things: theme, languages, networking, permissions, and the sign-in and verification screens.

The wrong start

At first each app had its own copy of that code, and a script copied changes between them. It sounds practical. It works exactly as well as remembering to run the script — and once nobody did, three apps went a while without a translation update before anyone noticed.

One package instead

I moved the shared half into a Dart package called sooq_core, and every app depends on it straight from the neighbouring folder. No copies, no script. Change it once and every app has it.

What lives in the core

  • The foundation: theme and colours, languages, networking, security and permissions.
  • For every feature, its domain and data layers — they are the same in every app.
  • The screens every app needs: sign-in, verification code, password reset and support.

Each app keeps only its own screens and routes.

One import

Every app has an app_core.dart that brings together the core and that app's own features, so a screen writes a single import line and gets everything. It sounds small; it keeps files clean and saves dozens of imports.

Tests once

Because the shared logic lives in one place, so do its tests — run once, for every app.

What I learned

  • Two copies of the same code is a bug waiting for its moment.
  • Put in the core what is actually shared, not what might be one day.
  • Each app's own screens stay in the app, so the core does not become the place everything goes.