From 563fe1fc4d4ee294abb246903749661f495048ea Mon Sep 17 00:00:00 2001 From: konrad Date: Mon, 3 Dec 2018 21:26:00 +0000 Subject: [PATCH] Fixed app not working with the newest api change which has multiple reminders (#19) --- lib/models/task.dart | 12 ++++++++---- pubspec.yaml | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/models/task.dart b/lib/models/task.dart index d011603..c96a583 100644 --- a/lib/models/task.dart +++ b/lib/models/task.dart @@ -3,7 +3,8 @@ import 'package:meta/meta.dart'; class Task { final int id; - final DateTime created, updated, reminder, due; + final DateTime created, updated, due; + final List reminders; final String text, description; final bool done; final User owner; @@ -12,7 +13,7 @@ class Task { {@required this.id, this.created, this.updated, - this.reminder, + this.reminders, this.due, @required this.text, this.description, @@ -23,7 +24,9 @@ class Task { : id = json['id'], updated = DateTime.fromMillisecondsSinceEpoch(json['updated']), created = DateTime.fromMillisecondsSinceEpoch(json['created']), - reminder = DateTime.fromMillisecondsSinceEpoch(json['reminderDate']), + reminders = (json['reminderDates'] as List) + ?.map((milli) => DateTime.fromMillisecondsSinceEpoch(milli)) + ?.toList(), due = DateTime.fromMillisecondsSinceEpoch(json['dueDate']), description = json['description'], text = json['text'], @@ -34,7 +37,8 @@ class Task { 'id': id, 'updated': updated?.millisecondsSinceEpoch, 'created': created?.millisecondsSinceEpoch, - 'reminderDate': reminder?.millisecondsSinceEpoch, + 'reminderDates': + reminders?.map((date) => date.millisecondsSinceEpoch)?.toList(), 'dueDate': due?.millisecondsSinceEpoch, 'description': description, 'text': text, diff --git a/pubspec.yaml b/pubspec.yaml index de541af..08b2456 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,6 +14,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2 flutter_secure_storage: 3.1.1 + http: 0.12.0 dev_dependencies: flutter_test: