getSublocationById method
Method is used for obtaining a sublocation with the specified identifier from the current location.
id sublocation identifier.
Returns The Sublocation of the current location with the specified identifier, if it exists. If sublocation with the specified identifier doesn't exist, function returns null.
Example:
// Get sublocation by ID
if (sublocations.isNotEmpty) {
Sublocation? sublocation = location.getSublocationById(sublocations.first.getId());
if (sublocation != null) {
demonstrateSublocationUsage(sublocation);
}
}
Implementation
@override
Sublocation getSublocationById(int id) {
final _getSublocationByIdFfi = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
Pointer<Void> Function(Pointer<Void>, Int32),
Pointer<Void> Function(Pointer<Void>, int)
>('navigine_sdk_flutter_Location_getSublocationById__Id'));
final _idHandle = navigine_sdk_flutter_int_ToFfi(id);
final _handle = this.handle;
final __resultHandle = _getSublocationByIdFfi(_handle, _idHandle);
navigine_sdk_flutter_int_ReleaseFfiHandle(_idHandle);
final _result = navigine_sdk_flutter_Sublocation_FromFfi(__resultHandle);
navigine_sdk_flutter_Sublocation_ReleaseFfiHandle(__resultHandle);
return _result;
}