From d715b4b20151d2cbc5c6676cc75e68a38e08968b Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 2 Dec 2024 16:39:34 +0100 Subject: [PATCH] Added ContentProvider --- lib/services/content_provider.dart | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/services/content_provider.dart diff --git a/lib/services/content_provider.dart b/lib/services/content_provider.dart new file mode 100644 index 0000000..1f19c19 --- /dev/null +++ b/lib/services/content_provider.dart @@ -0,0 +1,27 @@ +import 'dart:convert'; + +import 'package:flutter/services.dart'; + +class ContentProvider { + ContentProvider._(); + + static const String _jsonPath = 'assets/content.json'; + + static Future init() async { + try { + String file = await rootBundle.loadString(_jsonPath); + _content = json.decode(file); + } catch (e) { + return false; + } + return true; + } + + static Map _content = {}; + + static List get experience => _content['experience']; + + static List> get education => _content['education']; + + static List> get skills => _content['skills']; +}