put method
Sends a PUT request to the bridge for each resource in the list.
decrypter
When the old tokens are read from local storage, they are
decrypted. This parameter allows you to provide your own decryption
method. This will be used in addition to the default decryption method.
This will be performed after the default decryption method.
NOTE: This method will not send a PUT request for a resource that has a
null bridge
property.
Implementation
Future<void> put({String Function(String ciphertext)? decrypter}) async {
List<List<Resource>> nonPuttableResources = [
bridgeHomes,
behaviorScripts,
matterFabrics,
];
for (List<Resource> resourceList in resources) {
if (nonPuttableResources.contains(resourceList)) continue;
for (Resource resource in resourceList) {
Map<String, dynamic> data = resource.toJson();
if (data.isEmpty) continue;
if (resource.bridge != null) {
await resource.bridge!.put(resource, decrypter: decrypter);
}
}
}
}