mirror of
https://github.com/flutter/flutter
synced 2024-10-13 03:32:55 +00:00
implement override of toString() in order to print useful message in release mode as well as debug mode (#118263)
Added `_ErrorDescription.toString()`
This commit is contained in:
parent
b3f7699def
commit
b10f25c603
|
@ -223,6 +223,13 @@ abstract class _ErrorDiagnostic extends DiagnosticsProperty<List<Object>> {
|
|||
level: level,
|
||||
);
|
||||
|
||||
@override
|
||||
String toString({
|
||||
TextTreeConfiguration? parentConfiguration,
|
||||
DiagnosticLevel minLevel = DiagnosticLevel.info,
|
||||
}) {
|
||||
return valueToString(parentConfiguration: parentConfiguration);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object> get value => super.value!;
|
||||
|
|
|
@ -16,6 +16,13 @@ void main() {
|
|||
expect(log[1], contains('debugPrintStack'));
|
||||
});
|
||||
|
||||
test('should show message of ErrorDescription', () {
|
||||
const String descriptionMessage = 'This is the message';
|
||||
final ErrorDescription errorDescription = ErrorDescription(descriptionMessage);
|
||||
|
||||
expect(errorDescription.toString(), descriptionMessage);
|
||||
});
|
||||
|
||||
test('debugPrintStack', () {
|
||||
final List<String> log = captureOutput(() {
|
||||
final FlutterErrorDetails details = FlutterErrorDetails(
|
||||
|
|
Loading…
Reference in a new issue