getCategoryById abstract method

Category? getCategoryById(
  1. int id
)

Method is used for obtaining a category with the specified identifier from the current location. id category identifier. Returns Category of the current location with the specified identifier, if it exists. If category with the specified identifier doesn't exist, function returns null.

Example:

// Get category by ID
if (categories.isNotEmpty) {
 Category? category = location.getCategoryById(categories.first.getId());
 if (category != null) {
   demonstrateCategoryUsage(category);
 }
}

Implementation

Category? getCategoryById(int id);