Skip to content

AsyncImportCache runtime error when using cached null #1403

@Rafer45

Description

@Rafer45

AsyncImportCache uses the function putIfAbsentAsync, which uses the postfix ! on map[key] if the map has the key. However, this gives a runtime error when null values can legitimately be stored in the map. This is the case with the _canonicalizeCache, which is of type Map<Tuple2<Uri, bool>, Tuple3<AsyncImporter, Uri, Uri>?>

Instead of using the posfix !, putIfAbsentAsync should use as V, like the implementation of putIfAbsent in https://github.com/dart-lang/sdk/blob/master/sdk/lib/collection/maps.dart#L140

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions