From df2781ad18de99a77d34dd44201656ba454d6a37 Mon Sep 17 00:00:00 2001 From: Ahmed Masoud <47630729+maxzod@users.noreply.github.com> Date: Tue, 12 Apr 2022 03:04:06 +0200 Subject: [PATCH] Use kDebugMode in error_widget.0.dart example (#93408) --- examples/api/lib/widgets/framework/error_widget.0.dart | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/examples/api/lib/widgets/framework/error_widget.0.dart b/examples/api/lib/widgets/framework/error_widget.0.dart index 6456120b43..66c16ebd47 100644 --- a/examples/api/lib/widgets/framework/error_widget.0.dart +++ b/examples/api/lib/widgets/framework/error_widget.0.dart @@ -4,21 +4,15 @@ // Flutter code sample for ErrorWidget +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; void main() { // Set the ErrorWidget's builder before the app is started. ErrorWidget.builder = (FlutterErrorDetails details) { - // This is how to tell if you're in debug mode: Assertions are only executed in - // debug mode. - bool inDebug = false; - assert(() { - inDebug = true; - return true; - }()); // If we're in debug mode, use the normal error widget which shows the error // message: - if (inDebug) { + if (kDebugMode) { return ErrorWidget(details.exception); } // In release builds, show a yellow-on-blue message instead: