searchLandmarkDetails static method
Get details for the given landmark list.
The main purpose of this method is to populate the details for a landmark provided by selecting a landmark from the upper zoom level of the map. Other types of landmarks (such as the ones provided by search) are already up-to-date. Does not work with user created landmarks.
Parameters
- IN results The landmark list for which the landmarks details are searched.
- IN onComplete Will be invoked when the search operation is completed, providing the error code.
If the landmarks in list already have the details populated, the function will return GemError.upToDate.
- GemError.success if the search was successfully completed
- GemError.invalidated if the landmark provided is invalid (ex: user created landmark)
- GemError.upToDate if the landmark already has all the details.
Returns
- Associated TaskHandler for this operation if the search can be started otherwise null.
Implementation
static TaskHandler? searchLandmarkDetails(
final List<Landmark> results,
final void Function(GemError err) onComplete,
) {
final EventDrivenProgressListener progListener =
EventDrivenProgressListener();
GemKitPlatform.instance.registerEventHandler(progListener.id, progListener);
progListener.registerOnCompleteWithData((
final int err,
final String hint,
final Map<dynamic, dynamic> json,
) {
GemKitPlatform.instance.unregisterEventHandler(progListener.id);
if (err == GemError.success.code || err == GemError.reducedResult.code) {
onComplete(GemErrorExtension.fromCode(err));
} else {
onComplete(GemErrorExtension.fromCode(err));
}
});
final LandmarkList resultsList = LandmarkList();
results.forEach(resultsList.add);
final OperationResult resultString = staticMethod(
'SearchService',
'searchLandmarkDetails',
args: <String, dynamic>{
'results': resultsList.pointerId,
'listener': progListener.id,
},
);
final GemError errorCode =
GemErrorExtension.fromCode(resultString['result']);
if (errorCode != GemError.success) {
onComplete(errorCode);
return null;
}
return TaskHandlerImpl(progListener.id);
}