Skip to content

Commit

Permalink
Fixes the free food PROD bug.
Browse files Browse the repository at this point in the history
Apparently, was being caused by inconsistent message data being returned from PROD endpoints. Certain values in Message models could be null when they were not officially supposed to be.
  • Loading branch information
morebytes committed Nov 28, 2024
1 parent 7676a1d commit 83c687a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/core/models/notifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class Audience {
}

class Message {

String message;
String title;
Data data;
Expand All @@ -83,8 +84,9 @@ class Message {
});

Message.fromJson(Map<String, dynamic> json)
: message = json["message"],
title = json["title"],
// Defaulting to empty strings until we figure out what should or should not be null on the backend
: message = json["message"] ?? "",
title = json["title"] ?? "",
data = Data.fromJson(json["data"]);

Map<String, dynamic> toJson() => {
Expand Down

0 comments on commit 83c687a

Please sign in to comment.