From 45e4c5426a9090407dc1d210361c22ca83d8aa65 Mon Sep 17 00:00:00 2001 From: davidpkj Date: Sun, 5 Mar 2023 12:19:12 +0100 Subject: Update database, bump to version 1.6.1 --- lib/models/recipe_class.dart | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'lib/models/recipe_class.dart') diff --git a/lib/models/recipe_class.dart b/lib/models/recipe_class.dart index 6873a1f..e02ed87 100644 --- a/lib/models/recipe_class.dart +++ b/lib/models/recipe_class.dart @@ -1,8 +1,13 @@ -import 'dart:convert'; +import "package:isar/isar.dart"; import 'package:kulinar_app/models/data/recipe_data_class.dart'; +part "recipe_class.g.dart"; + +@collection class Recipe { + Id id = Isar.autoIncrement; + String? title; String? image; String? description; @@ -33,22 +38,6 @@ class Recipe { return true; } - static Recipe fromJson(String string) { - final json = jsonDecode(string); - - return Recipe(title: json["title"], image: json["image"], description: json["description"]); - } - - String toJsonString() { - Map map = { - "title": this.title ?? "", - "image": this.image ?? "", - "description": this.description ?? "", - }; - - return jsonEncode(map); - } - void toggleFavorite() { this.favorite = !this.favorite; } -- cgit v1.2.3