getComponent method

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

Implementation

Either<Exception, PagePropsEntity> getComponent(String name) {
  try {
    final currenState = state;
    if (currenState is! DesignFlowAppLoaded) {
      throw Exception('App not loaded');
    }
    if (_cachePages.containsKey(name)) {
      return Right(_cachePages[name]!);
    }
    final res = PagePropsEntity.fromJson(
      _getDecompressedData(
        currenState.token,
        currenState.assetsMapData[name],
      ),
    );
    _cachePages[name] = res;
    return Right(res);
  } catch (e) {
    return Left(Exception(e.toString()));
  }
}