getObject<T extends MeteorSharedObject> static method

Future<T?> getObject<T extends MeteorSharedObject>(
  1. String key,
  2. T constructor()
)

获取缓存对象 T 是继承自MeteorSharedObject类的的对象

Implementation

static Future<T?> getObject<T extends MeteorSharedObject>(
    String key, T Function() constructor) async {
  T instance = constructor();
  Map<String, dynamic>? json = await getMap(key);
  instance.setupFromJson(json);
  return instance;
}