dispose method

  1. @override
Future<bool> dispose()
override

Clears and frees all the resources used by this instance.

Implementation

@override
Future<bool> dispose() async {
  if (_isDisposed) {
    utils.log('This Nostr instance is already disposed.');
    return true;
  }

  _isDisposed = true;

  utils.log('A Nostr instance disposed successfully.');

  await Future.wait<dynamic>(<Future<bool>>[
    Future.value(keysService.freeAllResources()),
    relaysService.freeAllResources(),
  ]);

  return true;
}