getActionMeta method

Future<ActionMeta> getActionMeta (String actionName, { bool allowFetchMetadata: true, SpongeRequestContext context })

Returns the metadata for the specified action or null if there is no such action or that action has no metadata.

This method may fetch the metadata from the server or use the action metadata cache if configured. If you want to prevent fetching metadata from the server, set allowFetchMetadata to false. The default value is true.

Implementation

Future<ActionMeta> getActionMeta(String actionName,
    {bool allowFetchMetadata = true, SpongeRequestContext context}) async {
  allowFetchMetadata = allowFetchMetadata ?? true;
  if (_configuration.useActionMetaCache && _actionMetaCache != null) {
    ActionMeta actionMeta = await _actionMetaCache.get(actionName);
    // Populate the cache if not found.
    return actionMeta ??
        (allowFetchMetadata
            ? await _actionMetaCache.get(actionName,
                ifAbsent: (name) async =>
                    await _fetchActionMeta(name, context))
            : null);
  } else {
    return allowFetchMetadata
        ? await _fetchActionMeta(actionName, context)
        : null;
  }
}