populateFromService method

Future<FeatureQueryResult> populateFromService(
  1. {required QueryParameters parameters,
  2. required bool clearCache,
  3. required List<String> outFields}
)

Queries the feature service and places the resulting features in the local table, which is cached for the duration of the session. The ServiceFeatureTable must have its ServiceFeatureTable.featureRequestMode set to FeatureRequestMode.manualCache.

This method is useful for non-geographic data. It's also helpful when you want to avoid accessing the service for a feature whose geometry is in the current extent of the map or scene.

Specifying null or an empty List for outfields results in the minimum set of fields being used to populate the local table. This is the same set of fields described for FeatureRequestMode.onInteractionCache or FeatureRequestMode.onInteractionNoCache.

Parameters:

  • parameters — Options for controlling the operation.
  • clearCache — True, if you want to clear the local cache before populating the local table. False, if you want to append the features to the local table.
  • outFields — A List containing String. Each string is the name of a field to be used when populating the cache. If the array contains the single element "*", then all fields will be used. If the ObjectID field string name is not provided as part of the List, no features will be returned for this method.

Return Value: A Future that returns a FeatureQueryResult type.

Implementation

Future<FeatureQueryResult> populateFromService(
    {required QueryParameters parameters,
    required bool clearCache,
    required List<String> outFields}) {
  final coreOutFields =
      outFields.toMutableArray(valueType: _ElementType.string);
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_ServiceFeatureTable_populateFromService(_handle,
        parameters._handle, clearCache, coreOutFields._handle, errorHandler);
  });
  return taskHandle
      .toFuture((element) => element.getValueAsFeatureQueryResult()!);
}