transformDebugCreator function

Iterable<DiagnosticsNode> transformDebugCreator (Iterable<DiagnosticsNode> properties)

Transformer to parse and gather information about DiagnosticsDebugCreator.

This function will be registered to FlutterErrorDetails.propertiesTransformers in WidgetsBinding.initInstances.

Implementation

Iterable<DiagnosticsNode> transformDebugCreator(Iterable<DiagnosticsNode> properties) sync* {
  final List<DiagnosticsNode> pending = <DiagnosticsNode>[];
  bool foundStackTrace = false;
  for (DiagnosticsNode node in properties) {
    if (!foundStackTrace && node is DiagnosticsStackTrace)
      foundStackTrace = true;
    if (_isDebugCreator(node)) {
      yield* _parseDiagnosticsNode(node);
    } else {
      if (foundStackTrace) {
        pending.add(node);
      } else {
        yield node;
      }
    }
  }
  yield* pending;
}