import 'package:stackwallet/models/paynym/paynym_account_lite.dart'; import 'package:stackwallet/models/paynym/paynym_code.dart'; class PaynymAccount { final String nymID; final String nymName; final List codes; /// list of nymId final List followers; /// list of nymId final List following; PaynymAccount( this.nymID, this.nymName, this.codes, this.followers, this.following, ); PaynymAccount.fromMap(Map map) : nymID = map["nymID"] as String, nymName = map["nymName"] as String, codes = (map["codes"] as List) .map((e) => PaynymCode.fromMap(Map.from(e as Map))) .toList(), followers = (map["followers"] as List) .map((e) => PaynymAccountLite.fromMap(Map.from(e as Map))) .toList(), following = (map["following"] as List) .map((e) => PaynymAccountLite.fromMap(Map.from(e as Map))) .toList(); Map toMap() => { "nymID": nymID, "nymName": nymName, "codes": codes.map((e) => e.toMap()), "followers": followers.map((e) => e.toMap()), "following": followers.map((e) => e.toMap()), }; @override String toString() { return toMap().toString(); } }