json_dart_generator 0.9.5 copy "json_dart_generator: ^0.9.5" to clipboard
json_dart_generator: ^0.9.5 copied to clipboard

outdated

Convert json data to dart class Support multiple formats(root is array / multiple array) When the elements in the array are different, it will be converted to a mutually inclusive type as much as poss [...]

example/example.dart

import 'package:json_dart_generator/json_dart_generator.dart';

void main(List<String> args) {
  var jsonText = '''
[
  [
    {
      "aa": "cc",
      "bb": true,
      "cc": {
        "ilis": [
          10,
          20,
          30.0
        ]
      }
    }
  ]
]
  ''';

  var generator = DartCodeGenerator(
    rootClassName: 'Root', // 根類名
    rootClassNameWithPrefixSuffix: true, // 根類名是否套用前後綴
    classPrefix: 'Hi', // 類名前綴
    classSuffix: 'Go', // 類名後綴
  );

  // 呼叫 generate 帶入 json 字串生成 dart code
  var code = generator.generate(jsonText);
  print(code);
}
2
likes
0
pub points
62%
popularity

Publisher

unverified uploader

Convert json data to dart class Support multiple formats(root is array / multiple array) When the elements in the array are different, it will be converted to a mutually inclusive type as much as possible If they cannot contain each other, they will be displayed in a dynamic way, and the underlying elements will no longer be analyzed

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

args, convert, dart_style

More

Packages that depend on json_dart_generator