You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
open-im-sdk-flutter-m/lib/src/utils.dart

16 lines
521 B

import 'dart:convert';
class Utils {
static List<T> toList<T>(String value, T f(Map<String, dynamic> map)) =>
(formatJson(value) as List).map((e) => f(e)).toList();
static T toObj<T>(String value, T f(Map<String, dynamic> map)) =>
f(formatJson(value));
static List<dynamic> toListMap(String value) => formatJson(value);
static dynamic formatJson(String value) => jsonDecode(value);
static String checkOperationID(String? obj) =>
obj ?? DateTime.now().millisecondsSinceEpoch.toString();
}