mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
resolve mutation issue
This commit is contained in:
parent
c213745e5a
commit
f8d64218f2
1 changed files with 6 additions and 1 deletions
|
@ -33,7 +33,12 @@ abstract class ChainHeightServiceManager {
|
|||
// Close all subscriptions and clean up resources.
|
||||
static Future<void> dispose() async {
|
||||
// Close each subscription.
|
||||
for (final coin in _services.keys) {
|
||||
//
|
||||
// Create a list of keys to avoid concurrent modification during iteration
|
||||
var keys = List<Coin>.from(_services.keys);
|
||||
|
||||
// Iterate over the copy of the keys
|
||||
for (final coin in keys) {
|
||||
final ChainHeightService? service = getService(coin);
|
||||
await service?.cancelListen();
|
||||
remove(coin);
|
||||
|
|
Loading…
Reference in a new issue