getT<T> static method

T? getT<T>(
  1. String key,
  2. T fromJsonT(
    1. dynamic json
    )
)

获取sp中key的对象值

SpUtils.getT("key", (json) => A.fromJson(json));

Implementation

static T? getT<T>(String key, T Function(dynamic json) fromJsonT) {
  var str = _prefs.getString(key);
  return str.kfromJson(fromJsonT);
}