fetchPartById method

Future<Part?> fetchPartById(
  1. int partId
)

Implementation

Future<Part?> fetchPartById(int partId) async {
  Part? part = await _partLocalDataSource.fetchPartById(partId);
  if (part != null) {
    return part;
  } else {
    final MyResponse<Part> response = await _partApi.fetchPartById(partId);
    if (response.code == Apis.CODE_SUCCESS) {
      part = response.data as Part?;
    }
    return part;
  }
}