Skip to content

arif-rachim/dynamic_json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Access JSON attributes with dot operator.

Dynamic is a function that accepts JSON (Map), and returns a DynamicObject. With DynamicObject, we can take values ​​from JSON using dot operators instead of using brackets. We can also chain dot operators to retrieve nested values ​​from the Object too. When we perform chain calls, the last call must be closed with parentheses (as if calling a function) to get the actual value.

license.

Usage

A simple usage example:

import 'package:dynamic_json/dynamic_json.dart';

main() {
  final person = Dynamic({
    "FirstName": "Arif",
    "LastName": "Rachim",
    "Address": {
      "City": "Dubai",
      "Phone": "050123456",
      "Favorites": ["JavaScript", "ActionScript", "Java", "Dart"]
    }
  });
  print(person.FirstName()); // Arif
  print(person.Address.City()); // Dubai
  print(person.Address.Favorites()); // ["JavaScript","ActionScript","Java","Dart"]
  print(person.Address.Favorites[0]()); // JavaScript
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages