2020-06-20 07:10:00 +00:00
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
class BitcoinAddressRecord {
|
2021-05-07 07:36:38 +00:00
|
|
|
BitcoinAddressRecord(this.address, {this.index, bool isHidden})
|
|
|
|
: _isHidden = isHidden;
|
2020-06-20 07:10:00 +00:00
|
|
|
|
|
|
|
factory BitcoinAddressRecord.fromJSON(String jsonSource) {
|
|
|
|
final decoded = json.decode(jsonSource) as Map;
|
|
|
|
|
|
|
|
return BitcoinAddressRecord(decoded['address'] as String,
|
2021-05-07 07:36:38 +00:00
|
|
|
index: decoded['index'] as int, isHidden: decoded['isHidden'] as bool);
|
2020-06-20 07:10:00 +00:00
|
|
|
}
|
|
|
|
|
2021-01-11 17:15:27 +00:00
|
|
|
@override
|
|
|
|
bool operator ==(Object o) =>
|
|
|
|
o is BitcoinAddressRecord && address == o.address;
|
|
|
|
|
2020-06-20 07:10:00 +00:00
|
|
|
final String address;
|
2021-05-07 07:36:38 +00:00
|
|
|
bool get isHidden => _isHidden ?? false;
|
2020-08-25 16:32:40 +00:00
|
|
|
int index;
|
2021-05-07 07:36:38 +00:00
|
|
|
final bool _isHidden;
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2021-01-11 17:15:27 +00:00
|
|
|
@override
|
|
|
|
int get hashCode => address.hashCode;
|
|
|
|
|
2021-05-07 07:36:38 +00:00
|
|
|
String toJSON() =>
|
|
|
|
json.encode({'address': address, 'index': index, 'isHidden': isHidden});
|
2020-06-20 07:10:00 +00:00
|
|
|
}
|