Unverified Commit 173c93d9 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Minimal implementation of FlutterError.toString for release mode (#54291)

parent 49f3e1ac
...@@ -890,6 +890,10 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti ...@@ -890,6 +890,10 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti
@override @override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
if (kReleaseMode) {
final Iterable<_ErrorDiagnostic> errors = diagnostics.whereType<_ErrorDiagnostic>();
return errors.isNotEmpty ? errors.first.valueToString() : toStringShort();
}
// Avoid wrapping lines. // Avoid wrapping lines.
final TextTreeRenderer renderer = TextTreeRenderer(wrapWidth: 4000000000); final TextTreeRenderer renderer = TextTreeRenderer(wrapWidth: 4000000000);
return diagnostics.map((DiagnosticsNode node) => renderer.render(node).trimRight()).join('\n'); return diagnostics.map((DiagnosticsNode node) => renderer.render(node).trimRight()).join('\n');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment