Я разработал Rest API для своего приложения.Он отправляет приложению даты в следующем формате 2018-09-07T17:29:12+02:00
, где, как мне кажется, +2: 00 представляет мой часовой пояс как часть одного объекта.
В моем приложении Flutter после десериализации полученного объекта он вычитаетдва часа до фактического полученного объекта DateTime.
Класс, который я пытаюсь десериализовать, определяется следующим образом:
import 'package:json_annotation/json_annotation.dart';
part 'evento.g.dart';
@JsonSerializable(nullable: false)
class Evento {
final int id;
final String nombre;
final String discoteca;
final int precio_desde;
final int edad_minima;
final DateTime fecha_inicio;
final DateTime fecha_fin;
final DateTime fecha_fin_acceso;
final String cartel;
final bool incluyeCopa;
Evento(this.id, this.nombre, this.discoteca, this.precio_desde, this.edad_minima, this.fecha_inicio, this.fecha_fin, this.fecha_fin_acceso, this.cartel, this.incluyeCopa, this.num_tipos);
factory Evento.fromJson(Map<String, dynamic> json) => _$EventoFromJson(json);
Map<String, dynamic> toJson() => _$EventoToJson(this);
}