updateResource method
Notifies the client that resource
has been updated.
The implementation of that resource can optionally be updated, otherwise the previous implementation will be used.
Throws a StateError if resource
does not exist.
Implementation
void updateResource(
Resource resource, {
FutureOr<ReadResourceResult> Function(ReadResourceRequest)? impl,
}) {
if (!_resources.containsKey(resource.uri)) {
throw StateError(
'Failed to update resource ${resource.name}, there is no resource '
'at the URI ${resource.uri}, you must add it first using addResource.',
);
}
if (impl != null) _resourceImpls[resource.uri] = impl;
_subscribedResources[resource.uri]?.add(
ResourceUpdatedNotification(uri: resource.uri),
);
}