You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
samples/jsonexample/lib/json_serializable/serializable_simple_object....

34 lines
978 B

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:json_annotation/json_annotation.dart';
part 'serializable_simple_object.g.dart';
/// An annotation for the code generator to know that this class needs the
/// JSON serialization logic to be generated.
@JsonSerializable()
class SerializableSimpleObject {
SerializableSimpleObject({
this.aString,
this.anInt,
this.aDouble,
this.aListOfStrings,
this.aListOfInts,
this.aListOfDoubles,
});
final String? aString;
final int? anInt;
final double? aDouble;
final List<String>? aListOfStrings;
final List<int>? aListOfInts;
final List<double>? aListOfDoubles;
factory SerializableSimpleObject.fromJson(Map<String, dynamic> json) =>
_$SerializableSimpleObjectFromJson(json);
Map<String, dynamic> toJson() => _$SerializableSimpleObjectToJson(this);
}