Commit 8430accd authored by m-spi's avatar m-spi

Added categories in JSON and getter in TindBookState

parent 23f1a606
{
"books": [
"data": [
{
"isbn": "9781593275846",
"category": "book",
"title": "Eloquent JavaScript, Second Edition",
"subtitle": "A Modern Introduction to Programming",
"author": "Marijn Haverbeke",
......@@ -13,7 +13,7 @@
"website": "http://eloquentjavascript.net/"
},
{
"isbn": "9781449331818",
"category": "book",
"title": "Learning JavaScript Design Patterns",
"subtitle": "A JavaScript and jQuery Developer's Guide",
"author": "Addy Osmani",
......@@ -25,7 +25,7 @@
"website": "http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/"
},
{
"isbn": "9781449365035",
"category": "book",
"title": "Speaking JavaScript",
"subtitle": "An In-Depth Guide for Programmers",
"author": "Axel Rauschmayer",
......@@ -37,7 +37,7 @@
"website": "http://speakingjs.com/"
},
{
"isbn": "9781491950296",
"category": "book",
"title": "Programming JavaScript Applications",
"subtitle": "Robust Web Architecture with Node, HTML5, and Modern JS Libraries",
"author": "Eric Elliott",
......@@ -49,7 +49,7 @@
"website": "http://chimera.labs.oreilly.com/books/1234000000262/index.html"
},
{
"isbn": "9781593277574",
"category": "book",
"title": "Understanding ECMAScript 6",
"subtitle": "The Definitive Guide for JavaScript Developers",
"author": "Nicholas C. Zakas",
......@@ -61,7 +61,7 @@
"website": "https://leanpub.com/understandinges6/read"
},
{
"isbn": "9781491904244",
"category": "book",
"title": "You Don't Know JS",
"subtitle": "ES6 & Beyond",
"author": "Kyle Simpson",
......@@ -73,7 +73,7 @@
"website": "https://github.com/getify/You-Dont-Know-JS/tree/master/es6%20&%20beyond"
},
{
"isbn": "9781449325862",
"category": "book",
"title": "Git Pocket Guide",
"subtitle": "A Working Introduction",
"author": "Richard E. Silverman",
......@@ -85,7 +85,7 @@
"website": "http://chimera.labs.oreilly.com/books/1230000000561/index.html"
},
{
"isbn": "9781449337711",
"category": "book",
"title": "Designing Evolvable Web APIs with ASP.NET",
"subtitle": "Harnessing the Power of the Web",
"author": "Glenn Block, et al.",
......@@ -95,6 +95,36 @@
"description": "Design and build Web APIs for a broad range of clients—including browsers and mobile devices—that can adapt to change over time. This practical, hands-on guide takes you through the theory and tools you need to build evolvable HTTP services with Microsoft’s ASP.NET Web API framework. In the process, you’ll learn how design and implement a real-world Web API.",
"image": "assets/images/DesigningEvolvableWebAPIswithASPNET.jpg",
"website": "http://chimera.labs.oreilly.com/books/1234000001708/index.html"
},
{
"category": "course",
"title": "Build Your First Web Pages With HTML and CSS",
"author": "Emily Reese",
"publisher": "OpenClassrooms",
"completion_time": "10 hours",
"description": "Are you interested in making web pages? Look no further! In this course, you will learn how to use HTML5 and CSS3, the two types of code upon which all websites are based.",
"image": "assets/images/HTMLCSSCourse.jpg",
"website": "https://openclassrooms.com/en/courses/5265446-build-your-first-web-pages-with-html-and-css"
},
{
"category": "course",
"title": "Learn Programming With JavaScript",
"author": "Olga Volkova, Will Alexander",
"publisher": "OpenClassrooms",
"completion_time": "15 hours",
"description": "This course is designed to teach you the fundamentals of the JavaScript programming language and to give you lots of practice along the way!",
"image": "assets/images/LearnProgrammingWithJS.jpg",
"website": "https://openclassrooms.com/en/courses/5664271-learn-programming-with-javascript"
},
{
"category": "course",
"title": "Retrieve Data Using SQL",
"author": "Kurt Schuepfer",
"publisher": "OpenClassrooms",
"completion_time": "20 hours",
"description": "In this course, you will learn how to manipulate those tables using relational algebra operators, and apply these theoretical concepts to a very common language, SQL (Structured Query Language), which is used to interact with… relational databases!",
"image": "assets/images/SQLCourse.jpg",
"website": "https://openclassrooms.com/en/courses/5664271-learn-programming-with-javascript"
}
]
}
This diff is collapsed.
import 'dart:convert';
import 'dart:convert' show jsonDecode;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:english_words/english_words.dart';
const String filePath = '../assets/data.json';
class TindBookState extends ChangeNotifier {
String input = "";
var data;
late var data;
List<int> favorites = <int>[];
void loadData() async {
this.input = await rootBundle.loadString(filePath);
this.data = jsonDecode(input)['books'];
this.data = jsonDecode(input)['data'];
notifyListeners();
}
......@@ -32,4 +31,8 @@ class TindBookState extends ChangeNotifier {
notifyListeners();
}
}
List<String> get categories =>
[for (Map<String, dynamic> entry in data) entry['category']];
Set<String> get uniqueCategories => this.categories.toSet();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment