readList function

List? readList(
  1. dynamic raw,
  2. RenderContext context
)

A list slot — rows, items, tabs, options, nodes.

listOf(..., context) throws when the resolved value is anything else, and the renderer answers a throw by painting a red Error rendering … box over the widget. That state is normal rather than exceptional: a server response still loading, an author mid-edit, a path that holds a scalar for a moment. Measured on a published build — tabBar, dataTable and bottomNavigation each covered their own area with an error box while the rest of the page rendered.

A wrong-shaped list reads as EMPTY, which is what the widget would draw for no data anyway, and the mistake stays visible as an empty widget instead of as a stack trace on screen.

Implementation

List<dynamic>? readList(dynamic raw, RenderContext context) {
  final v = context.resolve<dynamic>(raw);
  if (v is List) return v;
  return null;
}