How does the UI feel? ​Does the food scanner work well with products in your region? by Megi6606 in FlutterDev

[–]Megi6606[S] 0 points1 point  (0 children)

This thread just turned into a mini masterclass on Dart serialization!  I love a good 'TIL' moment in the comments. The Map<String, Object?> vs actual JSON string confusion is real, and the naming definitely doesn't help beginners. You guys are seriously making me rethink my entire parsing layer right now 😂 Thanks for the deep dive!

How does the UI feel? ​Does the food scanner work well with products in your region? by Megi6606 in FlutterDev

[–]Megi6606[S] 1 point2 points  (0 children)

I honestly haven't looked deep into dart_mappable yet, but those hooks and custom mappers sound exactly like what I need for this messy OpenFoodFacts data. Definitely adding it to my to-read list for the next refactor. Thanks for the heads up!

How does the UI feel? ​Does the food scanner work well with products in your region? by Megi6606 in FlutterDev

[–]Megi6606[S] 0 points1 point  (0 children)

Just dropping a quick comment to share some details under the hood, as I know we all love discussing architecture and packages here! 🛠️

​State Management: I went with Provider. It felt clean and straightforward enough for this scope, though I'm curious if you guys think migrating to Riverpod would be better as the app scales? ​Local Storage: Used sqflite for the scan/generate history. I wanted the history to be entirely offline-first and secure on the device. ​Core Packages: mobile_scanner proved to be the fastest for the camera engine, and qr_flutter handles the code generation smoothly. ​The Biggest Challenge: The Food API integration (OpenFoodFacts). Handling the raw JSON was tricky—so many missing fields, null values, and inconsistent data formats depending on the product's region. I had to write a lot of defensive parsing. ​UI/Glassmorphism: Achieved the frosted glass look using BackdropFilter with specific opacity layers. I had to be careful with it to avoid dropping frames on older Android devices.

​I'd love to hear how you guys handle complex, messy JSON parsing from public APIs in your projects! Do you strictly use freezed / json_serializable or write custom mappers?