initialize static method

Future<FontInitStatus> initialize()

Implementation

static Future<FontInitStatus> initialize() {
  if (_initCompleter.isCompleted && _initStatus == FontInitStatus.success) {
    return Future.value(FontInitStatus.alreadyInitialized);
  }

  if (!_initializing) {
    _initializing = true;
    initFont().then(
      (value) {
        _initStatus = value ? FontInitStatus.success : FontInitStatus.failed;
        _initCompleter.complete(_initStatus);
        _initializing = false;
      },
    );
  }

  return _initCompleter.future;
}