CarpenterResourceController<T> constructor

CarpenterResourceController<T>({
  1. required CarpenterResourceLoader<T> load,
  2. String errorMessage(
    1. Object error
    )?,
})

Implementation

CarpenterResourceController({
  required CarpenterResourceLoader<T> load,
  this.errorMessage,
}) : _load = load,
     super(const CarpenterPageInitialLoading()) {
  refreshCommand = CarpenterCommandController<void>(
    id: 'resource.refresh',
    title: 'Обновить',
    presentation: CarpenterCommandPresentation.secondary,
    effects: const [
      CarpenterRefreshCommandEffect({'resource'}),
    ],
    execute: (_) async {
      await refresh();
      return const CarpenterCommandResult();
    },
  );
  _retryCommand = CarpenterCommandController<void>(
    id: 'resource.retry',
    title: 'Повторить',
    execute: (_) async {
      await refresh();
      return const CarpenterCommandResult();
    },
  );
}