Small Flutter strong mode cleanup fixes. (#7825)

* Small Flutter strong mode cleanup fixes.

These are cases where strong mode down cast composite errors
generally indicated cases that would performance or correctness
issues if Flutter code was run in a strong mode VM.

* Fix Command API so that it is always in terms of Map<String,String>.

* Fix typedef
This commit is contained in:
Jacob Richman
2017-02-06 08:55:09 -08:00
committed by Adam Barth
parent 82f887de07
commit 53fc96da9e
6 changed files with 19 additions and 18 deletions

View File

@@ -40,7 +40,7 @@ class CoverageCollector {
});
printTrace('pid $pid (port $port): collecting coverage data...');
final Map<dynamic, dynamic> data = await collect(host.address, port, false, false);
final Map<String, dynamic> data = await collect(host.address, port, false, false);
printTrace('pid $pid (port $port): ${ exitCode != null ? "process terminated prematurely with exit code $exitCode; aborting" : "collected coverage data; merging..." }');
if (exitCode != null)
throw new Exception('Failed to collect coverage, process terminated prematurely.');

View File

@@ -147,7 +147,7 @@ void _upgradeCollection(dynamic collection,
if (collection is ServiceMap) {
return;
}
if (collection is Map) {
if (collection is Map<String, dynamic>) {
_upgradeMap(collection, owner);
} else if (collection is List) {
_upgradeList(collection, owner);
@@ -156,11 +156,11 @@ void _upgradeCollection(dynamic collection,
void _upgradeMap(Map<String, dynamic> map, ServiceObjectOwner owner) {
map.forEach((String k, dynamic v) {
if ((v is Map) && _isServiceMap(v)) {
if ((v is Map<String, dynamic>) && _isServiceMap(v)) {
map[k] = owner.getFromMap(v);
} else if (v is List) {
_upgradeList(v, owner);
} else if (v is Map) {
} else if (v is Map<String, dynamic>) {
_upgradeMap(v, owner);
}
});
@@ -169,11 +169,11 @@ void _upgradeMap(Map<String, dynamic> map, ServiceObjectOwner owner) {
void _upgradeList(List<dynamic> list, ServiceObjectOwner owner) {
for (int i = 0; i < list.length; i++) {
dynamic v = list[i];
if ((v is Map) && _isServiceMap(v)) {
if ((v is Map<String, dynamic>) && _isServiceMap(v)) {
list[i] = owner.getFromMap(v);
} else if (v is List) {
_upgradeList(v, owner);
} else if (v is Map) {
} else if (v is Map<String, dynamic>) {
_upgradeMap(v, owner);
}
}
@@ -920,9 +920,9 @@ class ServiceMap extends ServiceObject implements Map<String, dynamic> {
@override
bool containsKey(Object k) => _map.containsKey(k);
@override
void forEach(Function f) => _map.forEach(f);
void forEach(void f(String key, dynamic value)) => _map.forEach(f);
@override
dynamic putIfAbsent(String key, Function ifAbsent) => _map.putIfAbsent(key, ifAbsent);
dynamic putIfAbsent(String key, dynamic ifAbsent()) => _map.putIfAbsent(key, ifAbsent);
@override
void remove(Object key) => _map.remove(key);
@override