getById method

Future<TurboResponse<MODEL>> getById({
  1. required String id,
  2. String? collectionPathOverride,
  3. bool tryCache = true,
  4. bool forceCacheRefresh = false,
})

Implementation

Future<TurboResponse<MODEL>> getById({
  required String id,
  String? collectionPathOverride,
  bool tryCache = true,
  bool forceCacheRefresh = false,
}) async {
  final response = await api.getByIdWithConverter(
    id: id,
    collectionPathOverride: collectionPathOverride,
    tryCache: tryCache,
    forceCacheRefresh: forceCacheRefresh,
  );
  if (response.isSuccess) {
    final model = upsertResult(dto: response.result!);
    return TurboResponse.success(
      result: model,
      title: response.title,
      message: response.message,
    );
  }
  return const TurboResponse.failAsBool();
}