ktoJson<T> method

String? ktoJson<T>(
  1. Map<String, dynamic> toJsonT(
    1. T value
    )
)

bean对象转json

  User.ktoJson<User>((value) => user.toJson(value))

Implementation

String? ktoJson<T>(Map<String, dynamic> Function(T value) toJsonT) {
  var file = this;
  if (file == null) return null;
  T t = file as T;
  var jsonStr = toJsonT.call(t);
  return jsonStr.ktoJson();
}