object_extension 1.0.1 copy "object_extension: ^1.0.1" to clipboard
object_extension: ^1.0.1 copied to clipboard

unlistedoutdated

The package extends the functionality of the base class Object

The package extends the functionality of the base class Object. This means that when the object_extension package is imported, absolutely all dart classes and objects (except for null) will have all the functions available in this package.

The functions of the package allow you to simplify the programming process and transform the data into an easy-to-understand form.

Method list #

Method Used for
toStructuredString() Allows you to convert any object to a structured text view. You can set the width of indents, the presence of quotes in keys and in string values. For debugging purposes, the function of showing data types is very good. Lists with simple elements of the same type are shown on one line. The same is true for sets. Map entries are always shown each on a separate line

Getting started #

To use any functions of the package, just install it. All functions will be automatically available in the entire hierarchy of dart classes, beginning with the Object class.

Usage #

Below are examples of transformations using the toStructuredString() function.

Sample Object:

{value1: v1, 10: 20.5, value2: v2, map1: {value7: v7, list4: [string1, string2], value8: v8}, list1: [0, 2, 3, 44, 55], set1: {5, {list2: [a, b]}, 55}, list3: [{value3: v3, value4: v4}, {value5: v5, value6: v6}, [1.3, [100, string3], 2.8, {666, 777}, 4, 5]]}

Structured Object with types:

_InternalLinkedHashMap<Object, Object> {
  value1: String 'v1',
  10: double 20.5,
  value2: String 'v2',
  map1: _InternalLinkedHashMap<String, Object> {
    value7: String 'v7',
    list4: List<String> [ 'string1', 'string2' ],
    value8: String 'v8'
  },
  list1: List<int> [ 0, 2, 3, 44, 55 ],
  set1: _CompactLinkedHashSet<Object> {
    int 5,
    _InternalLinkedHashMap<String, List<String>> {
      list2: List<String> [ 'a', 'b' ]
    },
    int 55
  },
  list3: List<Object> [
    _InternalLinkedHashMap<String, String> {
      value3: String 'v3',
      value4: String 'v4'
    },
    _InternalLinkedHashMap<String, String> {
      value5: String 'v5',
      value6: String 'v6'
    },
    List<Object> [
      double 1.3,
      List<Object> [
        int 100,
        String 'string3'
      ],
      double 2.8,
      _CompactLinkedHashSet<int> { 666, 777 },
      int 4,
      int 5
    ]
  ]
}

Structured Object:

{
  value1: 'v1',
  10: 20.5,
  value2: 'v2',
  map1: {
    value7: 'v7',
    list4: [ 'string1', 'string2' ],
    value8: 'v8'
  },
  list1: [ 0, 2, 3, 44, 55 ],
  set1: {
    5,
    {
      list2: [ 'a', 'b' ]
    },
    55
  },
  list3: [
    {
      value3: 'v3',
      value4: 'v4'
    },
    {
      value5: 'v5',
      value6: 'v6'
    },
    [
      1.3,
      [
        100,
        'string3'
      ],
      2.8,
      { 666, 777 },
      4,
      5
    ]
  ]
}
0
likes
0
pub points
7%
popularity

Publisher

unverified uploader

The package extends the functionality of the base class Object

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on object_extension