import 'dart:ui'; class Account { String label; String color; bool saving; double interest; Account({ this.label = '', this.color = '', this.saving = false, this.interest = 0.0, }); factory Account.fromJson(Map json) { return Account( label: json['label'], color: json['color'], saving: bool.parse(json['saving']), interest: double.parse(json['intereset']), ); } Map toJson() => { 'label': label, 'color': color, 'saving': saving.toString(), 'intereset': interest.toString(), }; Color rgbToColor() { return Color(int.parse(color.toUpperCase().replaceAll("#", ""), radix: 16)); } }