invokeMapMethod<K, V> method

  1. @override
Future<Map<K, V>> invokeMapMethod <K, V>(
  1. String method,
  2. [dynamic arguments]
)
override

An implementation of invokeMethod that can return typed maps.

Dart generics are reified, meaning that an untyped Map<dynamic, dynamic> cannot masquerade as a Map<K, V>. Since invokeMethod can only return dynamic maps, we instead create a new typed map using Map.cast.

See also:

Implementation

@override
Future<Map<K, V>> invokeMapMethod<K, V>(String method, [ dynamic arguments ]) async {
  final Map<dynamic, dynamic> result = await invokeMethod<Map<dynamic, dynamic>>(method, arguments);
  return result.cast<K, V>();
}