mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 03:06:29 +00:00
Fix error with deleting an address book entry
This commit is contained in:
parent
0f91ccd7ce
commit
365b117215
1 changed files with 8 additions and 2 deletions
|
@ -8,6 +8,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
@ -234,9 +236,13 @@ class _EditContactAddressViewState
|
||||||
e.coin == addressEntry.coin,
|
e.coin == addressEntry.coin,
|
||||||
);
|
);
|
||||||
|
|
||||||
_addresses.remove(entry);
|
//Deleting an entry directly from _addresses gives error
|
||||||
|
// "Cannot remove from a fixed-length list", so we remove the
|
||||||
|
// entry from a copy
|
||||||
|
var tempAddresses = List<ContactAddressEntry>.from(_addresses);
|
||||||
|
tempAddresses.remove(entry);
|
||||||
ContactEntry editedContact =
|
ContactEntry editedContact =
|
||||||
contact.copyWith(addresses: _addresses);
|
contact.copyWith(addresses: tempAddresses);
|
||||||
if (await ref
|
if (await ref
|
||||||
.read(addressBookServiceProvider)
|
.read(addressBookServiceProvider)
|
||||||
.editContact(editedContact)) {
|
.editContact(editedContact)) {
|
||||||
|
|
Loading…
Reference in a new issue