load method

Future<void> load()

Fetches, checks and opens the model; a failed load may be retried.

Implementation

Future<void> load() async {
  if (state == BrowserModelState.loading || loaded) return;
  state = BrowserModelState.loading;
  bytes = 0;
  total = plan?.bytes ?? 0;
  errorCode = null;
  errorMessage = null;
  _notify();
  final reply = await _worker.load(backend, (done, all) {
    bytes = done;
    total = all;
    _notify();
  });
  plan = reply.plan ?? plan;
  _settle(reply, BrowserModelState.loaded);
}