cpd_2022_zi/lib/services/json_service.dart

15 lines
459 B
Dart

import 'package:flutter/services.dart';
import 'dart:convert';
const String configJSONPath = 'assets/group3.json';
Future<Map<String, dynamic>> loadLocalConfigJSON() async {
String content = await rootBundle.loadString(configJSONPath);
return jsonDecode(content);
}
List<String>? jsonPropertyAsList(dynamic property) =>
property != null ? List.from(property) : null;
Map<String, dynamic> stringToJSON(String jsonString) => jsonDecode(jsonString);