Zip constructor
Creates $zip
operator expression
inputs
- An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. If any of the inputs arrays resolves to a value of null or refers to a missing field, $zip returns null. If any of the inputs arrays does not resolve to an array or null nor refers to a missing field, $zip returns an error.useLongestLength
- A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. The default value is false: the shortest array length determines the number of arrays in the output array.defaults
- An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else$zip
will return an error. IfuseLongestLength
:true
butdefaults
is empty or not specified,$zip
usesnull
as the default value. If specifying a non-emptydefaults
, you must specify a default for each input array or else$zip
will return an error.
Implementation
Zip({required List inputs, bool useLongestLength = false, List? defaults})
: super(
'zip',
AEObject({
'inputs': AEList(
inputs.map((elem) => elem is List ? AEList(elem) : elem)),
'useLongestLength': useLongestLength,
if (defaults != null && defaults.isNotEmpty)
'defaults': AEList(defaults)
}));