ArrayConverter class

Converts arbitrary values into array objects.

Example

var value1 = ArrayConverter.toArray([1, 2]);		 // Result: [1, 2]
var value2 = ArrayConverter.toArray(1);			  // Result: [1]
var value2 = ArrayConverter.listToArray("1,2,3");	// Result: ["1", "2", "3"]

Constructors

ArrayConverter()

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited

Static Methods

listToArray(dynamic value) → List
  • Converts value into array object with empty array as default.
    • Strings with comma-delimited values are split into array of strings.
      • value the list to convert.
    • Returns array object or empty array when value is null
    • See [toArray]
  • toArray(dynamic value) → List
  • Converts value into array object with empty array as default. Single values are converted into arrays with single element.
    • value the value to convert. Returns array object or empty array when value is null.
  • See [toNullableArray]
  • toArrayWithDefault(dynamic value, List defaultValue) → List
  • Converts value into array object with specified default. Single values are converted into arrays with single element.
    • value the value to convert.
    • defaultValue default array object. Returns array object or default array when value is null.
  • See [toNullableArray]
  • toNullableArray(dynamic value) → List
  • Converts value into array object. Single values are converted into arrays with a single element.
  • [...]