Skip to content

windrunner414/generic_json_converter_generator

Repository files navigation

generic_json_converter_generator

import 'package:generic_json_converter_annotation/generic_json_converter_annotation.dart';
import 'package:json_annotation/json_annotation.dart';

import 'model1.dart';
import 'model2.dart'

part 'generic_converter.g.dart';

@GenericJsonConverter(classes: [Model1, Model2])
class GenericConverter<T extends Object>
    with _$GenericConverterMixin<T>
    implements JsonConverter<T, Object> {
  const GenericConverter();
}
@JsonSerializable()
class serializable<T extends Object> {
    @GenericConverter()
    T data;

    serializable({this.data});

    ...fromJson...
    ...toJson...
}

About

A generic json converter generator for json_serializable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages