import 'dart:convert'; import 'package:flutter/services.dart'; import 'package:resume/constants.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 = { 'experience': >[], 'education': >[], 'skills': >[], 'text': [], 'general_skills': >[], }; static T getContent(ContentType contentType) { switch (contentType) { case ContentType.experience: return _content['experience'] as T; case ContentType.education: return _content['education'] as T; case ContentType.skills: return _content['skills'] as T; case ContentType.text: return _content['text'] as T; case ContentType.generalSkills: return _content['general_skills'] as T; default: return [] as T; } } }