toString method

  1. @override
String toString()
override

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.

Implementation

@override
// When adding new fields, ensure we don't go over the maximum length (100).
// Current length:
//   13 - nyxx_commands prefix
//   4  - / separators
//   6  - uniqueIdentifier (assume we won't go over 1 000 000 interactions in one session)
//   27 - sessionStartTime
//   27 - expiresAt
//   19 - allowedUser
// Total: 96, 4 free (could be used up by uniqueIdentifier)
// TODO: Serialize to binary => encode base64?
String toString() => 'nyxx_commands/$uniqueIdentifier/$sessionStartTime/$expiresAt/$allowedUser';