getRemoteComponent method

Future<Either<Exception, PagePropsEntity>> getRemoteComponent(
  1. String name
)

Implementation

Future<Either<Exception, PagePropsEntity>> getRemoteComponent(
    String name) async {
  try {
    final currenState = state;
    if (currenState is! DesignFlowAppLoaded) {
      throw Exception('App not loaded');
    }
    if (_cachePages.containsKey(name)) {
      return Right(_cachePages[name]!);
    }
    final service = ComponentService(currenState.token, getIt<Client>());
    final res = await service.getComponent(name, null);
    _cachePages[name] = res;
    return Right(res);
  } catch (e) {
    return Left(Exception(e.toString()));
  }
}