delete static method
Delete an existing resource.
bridgeIpAddr
is the IP address of the target bridge.
If a specific resource is being queried, include pathToResource
. This is
most likely the resource's ID.
applicationKey
is the key associated with this devices in the bridge's
whitelist.
The resourceType
is used to let the bridge know what type of resource is
being queried.
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.
May throw ExpiredAccessTokenException if trying to connect to the bridge remotely and the token is expired. If this happens, refresh the token with TokenRepo.refreshRemoteToken.
Implementation
static Future<Map<String, dynamic>?> delete({
required String bridgeIpAddr,
required String pathToResource,
required String applicationKey,
required ResourceType? resourceType,
String Function(String ciphertext)? decrypter,
}) async {
return await HueHttpClient.delete(
url: getTargetUrl(
bridgeIpAddr: bridgeIpAddr,
resourceType: resourceType,
pathToResource: pathToResource,
isRemote: false,
),
applicationKey: applicationKey,
token: null,
).timeout(
const Duration(seconds: 1),
onTimeout: () async {
String? token = await TokenRepo.fetchToken(decrypter: decrypter);
return await HueHttpClient.delete(
url: getTargetUrl(
bridgeIpAddr: bridgeIpAddr,
resourceType: resourceType,
pathToResource: pathToResource,
isRemote: true,
),
applicationKey: applicationKey,
token: token,
);
},
);
}