Message
A message (announcement, article or news) shown to participants in the app.
Messages are stored and fetched by a MessageManager, such as CarpResourceManager.
- Annotations
-
- @JsonSerializable(fieldRename: FieldRename.snake, includeIfNull: false, explicitToJson: true)
Constructors
Message.fromJson
Message
Creates a message.
If id is not specified, a UUID is assigned. If timestamp is not specified, the current time is used.
Properties
id
ID of the message. A UUID is generated if none is given.
image
The pathname for an image.
This image path can have two forms:
- URL - if the image path starts with http(s)://... the image is loaded from the internet using the
Image.network()constructor. - Asset - otherwise, it is assumed that this is the path to a local image asset and the image is loaded from the asset bundle using the
Image.asset()constructor.
message
A longer detailed message.
subTitle
A short sub title.
timestamp
Creation time. Defaults to the time the message was created.
title
A short title.
type
Type of message.
url
A URL to redirect the user to for an online item.
Methods
toJson
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.