Line data Source code
1 : import 'dart:convert'; 2 : import 'package:logger/logger.dart'; 3 : 4 4 : var logger = Logger(printer: PrettyPrinter()); 5 : 6 : class UtilityHelper { 7 1 : static bool isValidJson(jsonString) { 8 : try { 9 1 : if (jsonString is String) { 10 1 : json.decode(jsonString) as Map<dynamic, dynamic>; 11 : } 12 : return true; 13 1 : } on FormatException catch (e) { 14 4 : logger.w('The provided file is not valid JSON ${e.message}'); 15 : return false; 16 : } 17 : } 18 : 19 : // static String metadataText(container) { 20 : // if (container.isNotEmpty) { 21 : // if (container[0].nodes[0] is Text) { 22 : // return container[0].nodes[0].toString(); 23 : // } 24 : // return ''; 25 : // } 26 : // return ''; 27 : // } 28 : }