objToArray
Converts the given object to array format. The resulting array is a two-dimensional array with one key value stored as follows: [key, value]. If the recursive option is trueTrue, it will convert to a two-dimensional array again when the value is of type object.
Parameters
| Name | Type | Required | Default |
|---|---|---|---|
obj | objectMap<String, dynamic>dict | ● | – |
recursive named keyword | booleanbool | – | falseFalse |
namedThese parameters are passed as named parameters.
keywordThese parameters are passed as keyword arguments, or as a single dict in their place.
Returns
any[]
List<dynamic>
list[Any]
Examples
javascript
objToArray({
a: 1.234,
b: 'str',
c: [1, 2, 3],
d: { a: 1 }
}); // Returns [['a', 1.234], ['b', 'str'], ['c', [1, 2, 3]], ['d', { a: 1 }]]dart
objToArray({
'a': 1.234,
'b': 'str',
'c': [1, 2, 3],
'd': { 'a': 1 }
}); // Returns [['a', 1.234], ['b', 'str'], ['c', [1, 2, 3]], ['d', { 'a': 1 }]]python
objToArray({
'a': 1.234,
'b': 'str',
'c': [1, 2, 3],
'd': { 'a': 1 }
}) # Returns [['a', 1.234], ['b', 'str'], ['c', [1, 2, 3]], ['d', { 'a': 1 }]]