CanonicalizedMap.cast() throws _CastError
bobjackman opened this issue · comments
Bob Jackman commented
CanonicalizedMap.cast() throws _CastError
Example:
try {
var sourceMap = <String, String>{'a': 'A'};
var canonicalized = new CanonicalizedMap<String, String, String>.from(sourceMap, (String key) => key.toLowerCase());
var badResult = canonicalized.cast<String, String>();
var goodResult = Map.of(canonicalized).cast<String, String>();
print(goodResult); // {a: A}
print(badResult ); // _CastError: type 'MapEntry<String, String>' is not a subtype of type 'String' in type cast
} catch(e, s) {
print('Unhandled Exception: ${e.runtimeType}: $e\n$s');
}
Expected Result:
Calling .cast()
should not throw in this circumstance