invoke method

T? invoke({
  1. required bool isUseStatic,
  2. required T? onData(),
})

Implementation

T? invoke({
  required bool isUseStatic,
  required T? Function() onData,
}) {
  try {
    if (isUseStatic) {
      if (isInitialized) {
        return data;
      }
      data = onData();
      isInitialized = true;
      return data;
    }
    return onData();
  } catch (e) {
    return null;
  }
}