CommandWidget.stream constructor

CommandWidget.stream({
  1. required OutputWidget textOutputUi,
  2. OutputWidget? jsonOutputUi,
  3. OutputWidget? yamlOutputUi,
  4. OutputWidget? textErrorUi,
  5. OutputWidget? jsonErrorUi,
  6. OutputWidget? yamlErrorUi,
})

Like CommandWidget.text, but json/yaml emit one document per stream element instead of encoding the whole result. This is also used for operations that conceptually return a single result, but is awaited as a stream to allow for progress reporting.

Implementation

CommandWidget.stream({
  required this.textOutputUi,
  OutputWidget? jsonOutputUi,
  OutputWidget? yamlOutputUi,
  OutputWidget? textErrorUi,
  OutputWidget? jsonErrorUi,
  OutputWidget? yamlErrorUi,
}) : jsonOutputUi =
         jsonOutputUi ??
         FormattedStreamStringWidget(formatter: JsonOutputFormatter()),
     yamlOutputUi =
         yamlOutputUi ??
         FormattedStreamStringWidget(
           formatter: YamlOutputFormatter.document(),
         ),
     textErrorUi = textErrorUi ?? TextErrorWidget(),
     jsonErrorUi = jsonErrorUi ?? JsonErrorWidget(),
     yamlErrorUi = yamlErrorUi ?? YamlErrorWidget();