cake_wallet/lib/bitcoin/bitcoin_address_record.dart

20 lines
525 B
Dart
Raw Normal View History

2020-06-20 07:10:00 +00:00
import 'dart:convert';
class BitcoinAddressRecord {
2020-08-25 16:32:40 +00:00
BitcoinAddressRecord(this.address, {this.label, this.index});
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,
2020-08-25 16:32:40 +00:00
label: decoded['label'] as String, index: decoded['index'] as int);
2020-06-20 07:10:00 +00:00
}
final String address;
2020-08-25 16:32:40 +00:00
int index;
2020-06-20 07:10:00 +00:00
String label;
2020-08-25 16:32:40 +00:00
String toJSON() =>
json.encode({'label': label, 'address': address, 'index': index});
2020-06-20 07:10:00 +00:00
}