DBusDict constructor
DBusDict(
- DBusSignature keySignature,
- DBusSignature valueSignature, [
- Map<
DBusValue, DBusValue> children = const {}
Creates a new dictionary with keys of the type keySignature and values of the type valueSignature. keySignature and valueSignature must a single type. D-Bus doesn't allow sending and receiving dicts with keys that not basic types, i.e. byte, boolean, int16, uint16, int32, uint32, int64, uint64, double or unix_fd. An exception will be thrown when sending a message containing dicts using other types for keys.
An exception will be thrown if the DBusValues in children don't have signatures matching keySignature and valueSignature.
Implementation
DBusDict(this.keySignature, this.valueSignature, [this.children = const {}]) {
if (!keySignature.isSingleCompleteType) {
throw ArgumentError.value(keySignature, 'keySignature',
'Dict key type must be a single complete type');
}
if (!valueSignature.isSingleCompleteType) {
throw ArgumentError.value(valueSignature, 'valueSignature',
'Dict value type must be a single complete type');
}
children.forEach((key, value) {
if (key.signature.value != keySignature.value) {
throw ArgumentError.value(key, 'children',
"Provided key doesn't match signature ${keySignature.value}");
}
if (value.signature.value != valueSignature.value) {
throw ArgumentError.value(value, 'children',
"Provided value doesn't match signature ${valueSignature.value}");
}
});
}