-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work ondevexp-warningIssues with the analyzer's Warning codesIssues with the analyzer's Warning codeslegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.
Description
This tracker is for issues related to:
-
Analyzer
-
Dart SDK Version (
dart --version)
Dart SDK version: 2.12.0 (stable) (Thu Feb 25 19:50:53 2021 +0100) on "macos_x64"
Dart analyzer don't provide warning or compilation error when Map<String, Completer> is passed to a function with argument Map<String, Completer<Object?>>. But throws a error at runtime which basically remove all the benefits of a null/type safe code.
As you can see Completer is not equal to Completer<Object?>
code to replicate:
import 'dart:async';
void main() {
final Map<String, Completer<Object>> tracker = <String, Completer<Object>>{
'1': Completer(),
'2': Completer(),
'3': Completer(),
};
allCompleted(tracker);
// trows Uncaught Error: TypeError: null: type 'Null' is not a subtype of type 'Object'
tracker['2']?.complete();
allCompleted(tracker);
}
void allCompleted(final Map<String, Completer<Object?>> tracker) {
tracker.forEach(
(key, completer) => print("${key} is completed ${completer.isCompleted}"),
);
}Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work ondevexp-warningIssues with the analyzer's Warning codesIssues with the analyzer's Warning codeslegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.