Menu

Offline-first aquarium log in Flutter with Drift and Supabase
📰

Offline-first aquarium log in Flutter with Drift and Supabase

DEV Community: dart·Ivan Chernoknizhnikov·6 days ago
#7Ygm6fek
#devtodart#devto#dev#ammonia#reading
Long article (2405 words) — no AI summary yet.
Reading 0:00
15s threshold

This post is about the data model behind my aquarium app: readings where a

blank field never turns into a zero, free ammonia worked out from pH and

temperature, one stored unit per parameter, and a local Drift database that

syncs to Supabase through an outbox. The app is

Aquarium - Log Tracker ,

a free iPhone logbook for water tests, written in Flutter. What it does for

fishkeepers is in the user-facing post ;

this one is the code.

Blank is not zero

A water test is a handful of numbers typed standing at a tank, often with wet

hands, and nobody tests everything every time. So the first real decision was

what an empty field means. The answer is nothing. There is no nullable value

column: a parameter you didn't test produces no row at all.

for ( final setting in settings ) { final text = _controllers [ setting . key ] ? . text . trim ( ) ?? '' ; // An untouched field produces no reading at all. Never zero. if ( text . isEmpty ) continue ;

final value = double . tryParse ( text .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.