getInfo static method
Implementation
static Future<OfficeInfo?> getInfo() async {
if (_info != null) return _info!;
final officeHelper = getOfficeHelpers();
js.PromiseJsImpl<dynamic> promiseCallback(
final dynamic info,
) =>
js.PromiseJsImpl<dynamic>(
allowInterop((
final void Function(dynamic) resolve,
final Null Function(Object) reject,
) {
resolve(info);
}),
);
final jsInfoJsonJS = await handleThenable(
callMethod(
officeHelper,
'officeOnReady',
[allowInterop(promiseCallback)],
),
);
if (jsInfoJsonJS == null) return null;
final jsInfoJson = Map.castFrom<dynamic, dynamic, String, dynamic>(
dartify(jsInfoJsonJS),
);
if (jsInfoJson.values.where((final value) => value != null).isEmpty) {
return null;
}
return _info = OfficeInfo.fromJson(jsInfoJson);
}