Browse Source

isolating data structures

juan 1 month ago
parent
commit
d29650a7d0
1 changed files with 19 additions and 0 deletions
  1. 19 0
      lib/structs.dart

+ 19 - 0
lib/structs.dart

@@ -1,3 +1,5 @@
+//data structures
+
 import 'api_service.dart';
 
 
@@ -34,7 +36,24 @@ class GetThreadResponse {
   }
 }
 
+class MailAddress {
+  final String? name;
+  final String address;
+  MailAddress({this.name, required this.address});
 
+  factory MailAddress.fromJson(Map<String, dynamic> json) {
+    return MailAddress(
+      name: json['name'],
+      address: json['address'],
+    );
+  }
+
+  @override
+  String toString() {
+    // TODO: implement toString
+    return '${name} <${address}>';
+  }
+}
 // //old data structure
 // class SerializableMessage {
 //   final String name;