You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
Dart
44 lines
1.1 KiB
Dart
|
4 years ago
|
// To parse this JSON data, do
|
||
|
|
//
|
||
|
|
// final account = accountFromJson(jsonString);
|
||
|
|
|
||
|
|
import 'dart:convert';
|
||
|
|
|
||
|
|
import 'package:mohem_flutter_app/models/parent_list.dart';
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
Account accountFromJson(String str) => Account.fromJson(json.decode(str));
|
||
|
|
|
||
|
|
String accountToJson(Account data) => json.encode(data.toJson());
|
||
|
|
|
||
|
|
class Account {
|
||
|
|
Account({
|
||
|
|
required this.parentList,
|
||
|
|
required this.selectedItem,
|
||
|
|
});
|
||
|
|
|
||
|
|
List<ParentList>? parentList;
|
||
|
|
int selectedItem;
|
||
|
|
|
||
|
|
factory Account.fromJson(Map<String, dynamic> json) => Account(
|
||
|
|
parentList: json["parentList"] == null
|
||
|
|
? null
|
||
|
|
: List<ParentList>.from(
|
||
|
|
json["parentList"].map((x) => ParentList.fromJson(x))),
|
||
|
|
selectedItem:
|
||
|
|
json["selectedItem"] == null ? null : json["selectedItem"],
|
||
|
|
);
|
||
|
|
|
||
|
|
Map<String, dynamic> toJson() => {
|
||
|
|
"parentList": parentList == null
|
||
|
|
? null
|
||
|
|
: List<dynamic>.from(parentList!.map((x) => x.toJson())),
|
||
|
|
"selectedItem": selectedItem == null ? null : selectedItem,
|
||
|
|
};
|
||
|
|
|
||
|
|
Map<String, dynamic> toJsonData() => {
|
||
|
|
"selectedItem": selectedItem == null ? null : selectedItem,
|
||
|
|
};
|
||
|
|
}
|