Skip to content

Missing id/name in JSON parsed as "null" string #272

Description

@richardthe3rd

Severity: Low

Depends on upstream data quality.

Summary

Producer.fromJson (lib/models/drink.dart:30-31) and Product.fromJson (lib/models/drink.dart:140-141) parse identifiers with json['id'].toString() / json['name'].toString(). If id or name is missing or null, null.toString() produces the literal string "null".

Impact

Multiple records with a missing id all collapse to the id "null", causing:

  • ValueKey(drink.id) collisions in list builders (lib/screens/drinks_screen.dart:477, lib/main.dart:435), which can corrupt list rendering/state.
  • getDrinkById('null') and brewery lookups matching the wrong record.

Suggested fix

Handle null/empty id and name explicitly — skip the record, or generate a stable synthetic id — rather than coercing to "null".

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions