Enable strict-inference (#135043)

Avoids that dynamic accidentally sneaks in, see https://dart.dev/tools/analysis#enabling-additional-type-checks
This commit is contained in:
Michael Goderbauer
2023-09-20 12:59:08 -07:00
committed by GitHub
parent 96a4ae9dc5
commit b0a90aee17
27 changed files with 63 additions and 55 deletions

View File

@@ -16,6 +16,6 @@ String? bar;
/// error: widgets library was not imported (not even implicitly).
/// ```dart
/// print(Widget);
/// print(Widget); // error (undefined_identifier)
/// ```
String? foo;

View File

@@ -131,7 +131,7 @@
/// Widget build(BuildContext context) {
/// final String title;
/// return Opacity(
/// key: globalKey, // error (undefined_identifier, argument_type_not_assignable)
/// key: globalKey, // error (undefined_identifier)
/// opacity: _visible ? 1.0 : 0.0,
/// child: Text(title), // error (read_potentially_unassigned_final)
/// );
@@ -144,13 +144,14 @@
/// ```
///
/// ```dart
/// import 'dart:io'; // error (unused_import)/// final Widget p = Placeholder(); // error (undefined_class, undefined_function)
/// import 'dart:io'; // error (unused_import)
/// final Widget p = Placeholder(); // error (undefined_class, undefined_function)
/// ```
///
/// ```dart
/// // (e.g. in a stateful widget)
/// void initState() { // error (must_call_super, annotate_overrides)
/// widget.toString(); // error (undefined_identifier, return_of_invalid_type)
/// widget.toString();
/// }
/// ```
///