I'm building Underpeaks, a headless CMS that generates Flutter and Next.js apps from the same data models. It's in early testing, and most of what I've learned has come from things breaking. Here are four of those bugs, with what each one changed about how I build.
1. A UI flag that deleted the primary key
Fields in a model can be marked hidden . I added that for the admin UI: hide a field from the editing form. Later I reused the same flag in the public API, so hidden fields would also be stripped from responses. One boolean, two meanings.
The first generated Flutter app that used a model with a hidden field crashed with:
type 'Null' is not a subtype of type 'String'
Enter fullscreen mode
Exit fullscreen mode
The generated Dart model declares id as a non-nullable String . The API had removed id from the response, because id was a hidden field in the admin UI (nobody edits it by hand).…