startServer method

Future<bool> startServer()

Inicializa el servidor y carga las definiciones Se ejecuta una sola vez y las demás llamadas esperan a que termine

Implementation

Future<bool> startServer() async {
  if (state.starting || state.started) return _starting!;

  var completer = Completer<bool>();
  _starting = completer.future;

  try {
    state.update(dataIsLoadingState);
    await defs.restore();
    state.update(dataLoadingIsCompleteState);
    completer.complete(true);
  } catch (e) {
    state.error(dataLoadingError);
    completer.complete(false);
  }

  return completer.future;
}