Meal class

Represents a Meal tracked in the meal tracker application.

Each meal is associated with a date and contains information about its type, fat level, and sugar level.

Constructors

Meal({required int year, required int month, required int day, required String mealType, required int fatLevel, required int sugarLevel})
Constructs a Meal instance.

Properties

day int
The day the meal was recorded.
final
fatLevel int
The fat level recorded for the meal.
final
hashCode int
The hash code for this object.
no setterinherited
mealType String
The type of meal (e.g., Breakfast, Lunch, Dinner, Snack).
final
month int
The month the meal was recorded.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sugarLevel int
The sugar level recorded for the meal.
final
year int
The year the meal was recorded.
final

Methods

getFatLevelString() String
Converts the fat level to a string representation.
getSugarLevelString() String
Converts the sugar level to a string representation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
Converts the Meal instance into a JSON string.
toMap() Map<String, dynamic>
Converts the Meal instance into a Map.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromJson(String jsonString) Meal
Constructs a Meal instance from a JSON string.
fromLocalDBMap(Map<String, dynamic> map, int year, int month, int day) Meal
Constructs a Meal instance from a Map for local DB use.
fromMap(Map<String, dynamic> map) Meal
Constructs a Meal instance from a Map for API use.