import 'package:json_annotation/json_annotation.dart'; part 'location_info.g.dart'; @JsonSerializable() class LocationInfo { @JsonKey(name: 'userId') final String userId; @JsonKey(name: 'lng') final double? longitude; @JsonKey(name: 'lat') final double? latitude; @JsonKey(name: 'addr') final String? address; @JsonKey(name: 'timestamp') final int? lastUpdateTime; LocationInfo({ required this.userId, this.longitude, this.latitude, this.address, this.lastUpdateTime, }); factory LocationInfo.fromJson(Map json) => _$LocationInfoFromJson(json); Map toJson() => _$LocationInfoToJson(this); }