renderOtherStates function
void
renderOtherStates(})
Adds the other Nylo states on screen, and how to look at one, to block.
Implementation
void renderOtherStates(
LiveBlock block,
Map<String, Object?> payload, {
String target = 'metro live:run data',
}) {
final Object? listed = payload['states'];
if (listed is! List) return;
final Object? shown = _map(payload['state'])['state'];
final List<Map<String, Object?>> others = [
for (final Object? state in listed)
if (state is Map && state['state'] != shown) _map(state),
];
if (others.isEmpty) return;
block
..plain('')
..heading('Also on screen')
..table(
['WIDGET', 'STATE', 'KIND'],
[
for (final Map<String, Object?> state in others)
['${state['widget']}', '${state['name'] ?? '-'}', '${state['kind']}'],
],
)
..note('Look at one with $target ${others.first['widget']}');
}