To illustrate the point, let's look at code from BuiltListMultiMap:
factory BuiltListMultimap([multimap = const {}]) {
if (multimap is _BuiltListMultimap &&
multimap.hasExactKeyAndValueTypes(K, V)) {
return multimap as BuiltListMultimap<K, V>;
} else if (multimap is Map) {
return _BuiltListMultimap<K, V>.copy(multimap.keys, (k) => multimap[k]);
} else if (multimap is BuiltListMultimap) {
return _BuiltListMultimap<K, V>.copy(multimap.keys, (k) => multimap[k]);
} else {
return _BuiltListMultimap<K, V>.copy(multimap.keys, (k) => multimap[k]);
}
}
Here the parameter is typed dynamic multimap = const {}. As a result, the multimap.keys in the last else {} block is a dynamic get:keys call.
Now some applications may make classes implement the Map interface (e.g. proto classes with map mixins is common in g3).
=> This can now lead to thousands of small dynamic getter functions in production builds of an app.
=> Typing the parameter as Map multimap would avoid this
=> Similar dynamic calls are also in other places in the package:built_collection
/cc @davidmorgan
To illustrate the point, let's look at code from BuiltListMultiMap:
Here the parameter is typed
dynamic multimap = const {}. As a result, themultimap.keysin the lastelse {}block is a dynamicget:keyscall.Now some applications may make classes implement the
Mapinterface (e.g. proto classes with map mixins is common in g3).=> This can now lead to thousands of small dynamic getter functions in production builds of an app.
=> Typing the parameter as
Map multimapwould avoid this=> Similar dynamic calls are also in other places in the
package:built_collection/cc @davidmorgan