DEV Community

Cover image for Building CleanSync: why the rupee sign shaped our PDF code, and why ads ship switched off
Stacklyn Labs
Stacklyn Labs

Posted on

Building CleanSync: why the rupee sign shaped our PDF code, and why ads ship switched off

The job is done. The cleaner is packing the vacuum into the car, and the client wants the invoice before they leave. On WhatsApp, please.

That moment drove more of CleanSync's design than any feature list. CleanSync is our offline Flutter app for independent cleaners, small agencies and property managers: jobs with a timer and checklist, client properties, PDF estimates and invoices, and profit and expense tracking. No backend, no Firebase project, no accounts. Everything lives in a Hive CE database on the phone.

Below are the questions we kept asking while building it, and what we decided.

What happens when the invoice says ₹?

A PDF generated on a phone only knows the fonts you give it. The pdf package's built-in fonts don't cover symbols like ₹, so a cleaner in India gets a box where the currency should be. It's the kind of bug a developer in a euro or dollar market never sees in testing.

We bundle Noto Sans and use it as the PDF's base font, so €, £ and ₹ print correctly:

// simplified
Future<pw.Document> newInvoiceDoc() async {
  final data = await rootBundle.load('assets/fonts/NotoSans-Regular.ttf');
  final font = pw.Font.ttf(data);
  return pw.Document(theme: pw.ThemeData.withFont(base: font));
}
Enter fullscreen mode Exit fullscreen mode

The UI font, Outfit, is bundled too. The project uses google_fonts, but only with bundled files, so nothing is downloaded at runtime. That's what lets the app work without a connection from the very first launch, not just after it has cached something.

Sharing goes through the phone's own share sheet, which means WhatsApp, email or whatever the cleaner uses. In the web preview the PDF is saved as a file instead.

What should an invoice actually prove?

A cleaning invoice is partly a receipt and partly evidence. "Did you do the oven?" is a real question clients ask.

So the checklist does two jobs. While working, ticking every task marks the job Completed automatically. Afterwards, the invoice includes a checklist audit showing which tasks were done, along with a unique number like INV-20261022-A1B2.

// simplified: a provider method
void toggleTask(Job job, int index) {
  job.checklist[index].done = !job.checklist[index].done;
  if (job.checklist.every((t) => t.done)) {
    job.status = JobStatus.completed;
  }
  job.save(); // Hive CE object
  notifyListeners();
}
Enter fullscreen mode Exit fullscreen mode

State is plain Provider: PropertyProvider, SettingsProvider and StatsProvider over typed Hive CE models. Jobs also carry a start, pause and reset timer whose time is saved with the job, and a pre-job estimate PDF uses the same checklist with an estimated total.

CleanSync job screen with work timer, cleaning checklist and the estimate and invoice menu

Should a template ship with ads turned on?

Not in our view. Version 1.1.2 made that the default.

The project still includes the Google Mobile Ads SDK for optional interstitials. But AdConfig.enabled is false out of the box. With it off, the app shows no ads, shows no consent form and makes no ad requests. Release ad unit IDs are clear placeholders, and no ad is requested while a placeholder is set. The source contains no AdMob IDs belonging to us; the App ID is Google's official sample ID, which the SDK needs to start.

When a developer does turn ads on, the rules are deliberately tight. An ad may appear only after a job is completed, at most 2 per session, at least 3 minutes apart, with a Google UMP consent form where the law requires it.

// simplified
class AdGate {
  int _shown = 0;
  DateTime? _last;

  bool canShowAfterJob() {
    if (!AdConfig.enabled) return false;
    if (AdConfig.interstitialId.startsWith('YOUR_')) return false;
    if (_shown >= 2) return false;
    final last = _last;
    if (last != null &&
        DateTime.now().difference(last) < const Duration(minutes: 3)) {
      return false;
    }
    return true;
  }

  void markShown() {
    _shown++;
    _last = DateTime.now();
  }
}
Enter fullscreen mode Exit fullscreen mode

Why after a completed job? Because that's the one moment nobody is in the middle of something. An interstitial on top of the job timer would be awful.

The in-app privacy policy only mentions AdMob when ads are enabled, and an ADS.md file covers setup and how to remove the SDK completely.

Where does branding live?

In a few small files, each with one job. App name, company, support email and website are in one BrandConfig file. All colours are named tokens in one theme file. Ad settings sit separately in AdConfig. The launcher icon and splash are generated from your own image with flutter_launcher_icons and flutter_native_splash.

CleanSync property screens with client list, search, call, WhatsApp, directions and job history

What it doesn't do

  • No team features. No backend and no user accounts, so there's no shared job list between cleaners. Data lives on one phone, and moving it means a .zip backup (photos included).
  • The web build is a developer preview. No notifications, ads or share sheet there.
  • No ad credentials. If you want ads, you bring your own AdMob account, App IDs and ad unit IDs.
  • Reminders are mobile-only. Job reminders are local notifications one hour before each pending job, on Android and iOS.

Stack: Flutter 3.47 or newer, Dart 3.13 or newer, Provider, Hive CE, Android with Flutter's default SDK levels and iOS 15.0 and up, 29 unit and widget tests.

Try it

The source code costs $29.

Have you shipped PDFs from a Flutter app to users outside your own currency? Which symbol bit you first?

Top comments (0)