renderStoredValue function

void renderStoredValue(
  1. LiveBlock block,
  2. String key,
  3. Map<String, Object?> payload, {
  4. required String missing,
})

Adds the whole value the app holds for key to block, untruncated.

missing is the note shown when the app holds no value for it.

Implementation

void renderStoredValue(
  LiveBlock block,
  String key,
  Map<String, Object?> payload, {
  required String missing,
}) {
  if (payload['exists'] != true) {
    block.note(missing);
    return;
  }
  final Object? expiresAt = payload['expiresAt'];
  block.heading(
    '$key  ${payload['type'] ?? ''}'
            '${expiresAt != null ? '  expires $expiresAt' : ''}'
        .trimRight(),
  );
  final Object? value = payload['value'];
  if (value is Map || value is List) {
    block.json(value);
  } else {
    block.plain('$value');
  }
}