From ad496e142b9a1c114dea65e7d87e474cd85dd5c2 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Sat, 22 Apr 2017 10:27:03 +0200 Subject: [PATCH] enable lint overridden_fields (#9527) * enable lint overridden_fields * address review comment --- .analysis_options | 2 +- .analysis_options_repo | 2 +- packages/flutter/lib/src/foundation/assertions.dart | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.analysis_options b/.analysis_options index 4bd0213736..301de55cad 100644 --- a/.analysis_options +++ b/.analysis_options @@ -86,7 +86,7 @@ linter: # - omit_local_variable_types # opposite of always_specify_types # - one_member_abstracts # too many false positives # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 - # - overridden_fields # not yet tested + - overridden_fields - package_api_docs - package_prefixed_library_names # - parameter_assignments # we do this commonly diff --git a/.analysis_options_repo b/.analysis_options_repo index ef275a0160..c3f0da1dc8 100644 --- a/.analysis_options_repo +++ b/.analysis_options_repo @@ -84,7 +84,7 @@ linter: # - omit_local_variable_types # opposite of always_specify_types # - one_member_abstracts # too many false positives # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 - # - overridden_fields # not yet tested + - overridden_fields - package_api_docs - package_prefixed_library_names # - parameter_assignments # we do this commonly diff --git a/packages/flutter/lib/src/foundation/assertions.dart b/packages/flutter/lib/src/foundation/assertions.dart index 29d045ace8..ca1601fb2f 100644 --- a/packages/flutter/lib/src/foundation/assertions.dart +++ b/packages/flutter/lib/src/foundation/assertions.dart @@ -105,7 +105,9 @@ class FlutterErrorDetails { /// Converts the [exception] to a string. /// - /// This applies some additional logic to + /// This applies some additional logic to make [AssertionError] exceptions + /// prettier, to handle exceptions that stringify to empty strings, to handle + /// objects that don't inherit from [Exception] or [Error], and so forth. String exceptionAsString() { String longMessage; if (exception is AssertionError) { @@ -151,7 +153,7 @@ class FlutterError extends AssertionError { /// Include as much detail as possible in the full error message, /// including specifics about the state of the app that might be /// relevant to debugging the error. - FlutterError(this.message); + FlutterError(String message) : super(message); /// The message associated with this error. /// @@ -169,7 +171,7 @@ class FlutterError extends AssertionError { /// All sentences in the error should be correctly punctuated (i.e., /// do end the error message with a period). @override - final String message; + String get message => super.message; @override String toString() => message;