json_parser_annotations

Annotations to support analysis and code-gen features for json_parser package.

Note: This package is a part of the json_parser suite.

Overview

Defines annotations to support analysis and code-gen features for json_parser package.

Installation

From pub.dev

Add this to your pubspec.yaml

dependencies:
  json_parser_annotations: ^1.0.1

Or, From Git repo

dependencies:
  json_parser_annotations:
    git:
      url: https://github.com/Ragibn5/dart-flutter-packages.git
      path: json_parser/json_parser_annotations
      ref: json_parser/json_parser_annotations-1.0.1

Usage

Annotate the components you want to expose:

import 'package:json_parser_annotations/json_parser_annotations.dart';

@GenerateJsonParser()
class User {
  final int id;
  final String name;

  User(this.id, this.name);

  @override
  String toString() {
    return 'User{id: $id, name: $name}';
  }
}

Once annotated, generators, analyzers and other tools can find these components and apply their integrations.

Example

See the example for a complete demonstration of all the annotations.

Libraries

json_parser_annotations
Annotations to support analysis and code-gen features for json_parser package.