Parameters

Contains a map with execution parameters.

Extends: AnyValueMap

Description

The Parameters class contains a map with execution paramters.

Important points

  • In general, this map may contain non-serializable values.
  • In contrast with other maps, its getters and setters support dot notation and are able to access properties in the entire object graph.
  • This class is often used to pass execution and notification arguments, and parameterize classes before execution.

Constructors

Creates a new instance of the map and assigns its value.

Parameters([values])

  • values: dynamic - (optional) values to initialize this map.

Instance methods

assignTo

Assigns (copies over) properties from the specified value to this map.

void assignTo(value)

  • value: dynamic - value whose properties shall be copied over.

containsKey

Checks if this map contains an element with a specified key.

The key can be defined using dot notation and allows to recursively access elements of elements.

bool containsKey(Object? key)

  • key: Object? - key to be checked
  • returns: bool - true if this map contains the key or false otherwise.

get

Gets a map’s element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements.

dynamic get(String? key)

  • key: String? - key of the element to get.
  • returns: dynamic - value of the map element.

getAsNullableParameters

Converts a map’s element into a Parameters object or returns null if the conversion is not possible.

Parameters? getAsNullableParameters(String key)

  • key: String - key of the element to get.
  • returns: Parameters? - Parameters value of the element or null if the conversion is not supported.

getAsParameters

Converts a map’s element into a Parameters object or returns an empty Parameters object if the conversion is not possible.

Parameters getAsParameters(String key)

  • key: String - key of element to get.
  • returns: Parameters - Parameters value of the element or empty Parameters object if the conversion is not supported.

getAsParametersWithDefault

Converts a map’s element into a Parameters object or returns a given default value if the conversion is not possible.

Parameters getAsParametersWithDefault(String key, Parameters defaultValue)

  • key: String - key of element to get.
  • defaultValue: Parameters - default value
  • returns: Parameters - Parameters value of the element or default value if the conversion is not supported.

omit

Omits selected parameters from this Parameters object and returns the rest as a new Parameters object.

Parameters omit(List<String> paths)

override

Overrides parameters with new values from a specified Parameters object and returns a new Parameters object.

Parameters override(Parameters? parameters, [bool recursive = false])

  • parameters: Parameters? - Parameters with parameters to override the current values.
  • recursive: bool - (optional) true to perform a deep copy, and false for a shallow copy. Default: false
  • returns: Parameters - new Parameters object.

pick

Picks select parameters from this Parameters object and returns them as a new Parameters object.

Parameters pick(List<String> paths)

  • paths: List<String> - keys to be picked and copied over to the new Parameters object.
  • returns: Parameters - new Parameters object.

put

Puts a new value into a map’s element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements.

void put(String? key, value)

  • key: String? - key of the element to put.
  • value: dynamic - new value for map element.

setDefaults

Sets default values from a specified Parameters object and returns a new Parameters object.

Parameters setDefaults(Parameters defaultParameters, [bool recursive = false])

  • defaultParameters: Parameters - Parameters object with default parameter values.
  • recursive: bool - (optional) true to perform a deep copy, and false for a shallow copy. Default: false.
  • returns: Parameters - new Parameters object.

toJsonString

Converts this map to a JSON object.

String? toJsonString()

  • returns: String? - JSON representation of this map.

Static methods

fromConfig

Creates new Parameters object from a ConfigMap object. See ConfigParams

static Parameters fromConfig(ConfigParams? config)

  • config: ConfigParams? - ConfigParams object that contains parameters.
  • returns: Parameters - new Parameters object.

fromJson

Creates new Parameters object from a JSON string.

static Parameters fromJson(Map<String, dynamic> json)

  • config: Map<String, dynamic> - json string that contains parameters.
  • returns: Parameters - new Parameters object.

fromTuples

Creates a new Parameters object filled with provided key-value pairs called tuples. Tuples parameters contain a sequence of key1, value1, key2, value2, … pairs.

See AnyValueMap.fromTuplesArray

static Parameters fromTuples(List tuples)

  • tuples: dynamic - ConfigParams object that contain parameters.
  • returns: Parameters - new Parameters object.

fromValue

Creates a new Parameters object filled with key-value pairs from a specified object.

static Parameters fromValue(value)

  • tuples: dynamic - object with key-value pairs used to initialize a new Parameters object.
  • returns: Parameters - new Parameters object.

mergeParams

Merges two or more Parameters objects into one. The resulting Parameters object overrides previously defined parameters.

See AnyValueMap.fromMaps

static Parameters mergeParams(List<Parameters> parameters)

  • parameters: List<Parameters> - list of Parameters objects to be merged.
  • returns: Parameters - new Parameters object.

See also