From 1b406159f2aef4aa8955938621608a7a5c0edb27 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 16 Jul 2020 16:21:05 -0700 Subject: [PATCH] Give better error message for describeEnum (#61581) --- packages/flutter/lib/src/foundation/diagnostics.dart | 5 ++++- packages/flutter/test/foundation/diagnostics_test.dart | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index 0974841189..a1af8f7c3a 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -3032,7 +3032,10 @@ String describeIdentity(Object? object) => '${objectRuntimeType(object, ' describeEnum('Hello World'), + throwsA(isAssertionError.having( + (AssertionError e) => e.message, + 'message', + 'The provided object "Hello World" is not an enum.'), + ), + ); }); test('string property test', () {