getCategoryById method
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
@override
Category? getCategoryById(int id) {
final _getCategoryByIdFfi = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
Pointer<Void> Function(Pointer<Void>, Int32),
Pointer<Void> Function(Pointer<Void>, int)
>('navigine_sdk_flutter_Location_getCategoryById__Id'));
final _idHandle = navigine_sdk_flutter_int_ToFfi(id);
final _handle = this.handle;
final __resultHandle = _getCategoryByIdFfi(_handle, _idHandle);
navigine_sdk_flutter_int_ReleaseFfiHandle(_idHandle);
final _result = navigine_sdk_flutter_Category_FromFfiNullable(__resultHandle);
navigine_sdk_flutter_Category_ReleaseFfiHandleNullable(__resultHandle);
return _result;
}