220 lines
4.5 KiB
Dart
220 lines
4.5 KiB
Dart
import 'dart:convert';
|
|
|
|
class FleetModel {
|
|
List<Data>? data;
|
|
|
|
FleetModel({this.data});
|
|
|
|
factory FleetModel.fromJson(Map<String, dynamic> json) {
|
|
final dataList = json['data'] as List<dynamic>;
|
|
|
|
final List<Data> data = dataList.map((e) => Data.fromJson(e)).toList();
|
|
|
|
return FleetModel(data: data);
|
|
}
|
|
}
|
|
|
|
class Data {
|
|
String? symbol;
|
|
Nav? nav;
|
|
Registration? registration;
|
|
Fuel? fuel;
|
|
//Frame? frame;
|
|
//Reactor? reactor;
|
|
//Engine? engine;
|
|
//List<Module>? modules;
|
|
//List<Mount>? mounts;
|
|
Cargo? cargo;
|
|
|
|
Data({
|
|
this.symbol,
|
|
this.nav,
|
|
this.registration,
|
|
this.fuel,
|
|
//this.frame,
|
|
//this.reactor,
|
|
//this.engine,
|
|
//this.modules,
|
|
//this.mounts,
|
|
this.cargo,
|
|
});
|
|
|
|
factory Data.fromJson(Map<String, dynamic> json) {
|
|
return Data(
|
|
symbol: json['symbol'],
|
|
nav: Nav.fromJson(json['nav']),
|
|
registration: Registration.fromJson(json['registration']),
|
|
fuel: Fuel.fromJson(json['fuel']),
|
|
//frame: Frame.fromJson(json['frame']),
|
|
//reactor: Reactor.fromJson(json['reactor']),
|
|
//engine: Engine.fromJson(json['engine']),
|
|
//modules: List<Module>.from(json['modules']?.map((x) => Module.fromJson(x))),
|
|
//mounts: List<Mount>.from(json['mounts']?.map((x) => Mount.fromJson(x))),
|
|
cargo: Cargo.fromJson(json['cargo']),
|
|
);
|
|
}
|
|
}
|
|
|
|
class Nav {
|
|
String? systemSymbol;
|
|
String? waypointSymbol;
|
|
Route? route;
|
|
String? status;
|
|
String? flightMode;
|
|
|
|
Nav({
|
|
this.systemSymbol,
|
|
this.waypointSymbol,
|
|
this.route,
|
|
this.status,
|
|
this.flightMode,
|
|
});
|
|
|
|
factory Nav.fromJson(Map<String, dynamic> json) {
|
|
return Nav(
|
|
systemSymbol: json['systemSymbol'],
|
|
waypointSymbol: json['waypointSymbol'],
|
|
route: Route.fromJson(json['route']),
|
|
status: json['status'],
|
|
flightMode: json['flightMode'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Route {
|
|
Departure? departure;
|
|
Destination? destination;
|
|
String? arrival;
|
|
String? departureTime;
|
|
|
|
Route({
|
|
this.departure,
|
|
this.destination,
|
|
this.arrival,
|
|
this.departureTime,
|
|
});
|
|
|
|
factory Route.fromJson(Map<String, dynamic> json) {
|
|
return Route(
|
|
departure: Departure.fromJson(json['departure']),
|
|
destination: Destination.fromJson(json['destination']),
|
|
arrival: json['arrival'],
|
|
departureTime: json['departureTime'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Departure {
|
|
String? symbol;
|
|
String? type;
|
|
String? systemSymbol;
|
|
int? x;
|
|
int? y;
|
|
|
|
Departure({
|
|
this.symbol,
|
|
this.type,
|
|
this.systemSymbol,
|
|
this.x,
|
|
this.y,
|
|
});
|
|
|
|
factory Departure.fromJson(Map<String, dynamic> json) {
|
|
return Departure(
|
|
symbol: json['symbol'],
|
|
type: json['type'],
|
|
systemSymbol: json['systemSymbol'],
|
|
x: json['x'],
|
|
y: json['y'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Destination {
|
|
String? symbol;
|
|
String? type;
|
|
String? systemSymbol;
|
|
int? x;
|
|
int? y;
|
|
|
|
Destination({
|
|
this.symbol,
|
|
this.type,
|
|
this.systemSymbol,
|
|
this.x,
|
|
this.y,
|
|
});
|
|
|
|
factory Destination.fromJson(Map<String, dynamic> json) {
|
|
return Destination(
|
|
symbol: json['symbol'],
|
|
type: json['type'],
|
|
systemSymbol: json['systemSymbol'],
|
|
x: json['x'],
|
|
y: json['y'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Registration {
|
|
String? name;
|
|
String? factionSymbol;
|
|
String? role;
|
|
|
|
Registration({this.name,this.factionSymbol,this.role});
|
|
|
|
factory Registration.fromJson(Map<String, dynamic> json) {
|
|
return Registration(
|
|
name: json['name'],
|
|
factionSymbol: json['factionSymbol'],
|
|
role: json['role'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Fuel {
|
|
int? current;
|
|
int? capacity;
|
|
Consumed? consumed;
|
|
|
|
Fuel({this.current, this.capacity, this.consumed});
|
|
|
|
factory Fuel.fromJson(Map<String, dynamic> json) {
|
|
return Fuel(
|
|
current: json['current'],
|
|
capacity: json['capacity'],
|
|
consumed: Consumed.fromJson(json['consumed']),
|
|
);
|
|
}
|
|
}
|
|
|
|
class Cargo {
|
|
int? capacity;
|
|
int? units;
|
|
//List<Inventory>? inventory;
|
|
|
|
Cargo({this.capacity, this.units});//, this.inventory});
|
|
|
|
factory Cargo.fromJson(Map<String, dynamic> json) {
|
|
return Cargo(
|
|
capacity: json['capacity'],
|
|
units: json['unit'],
|
|
//inventory: json.decode(json['inventory']),
|
|
);
|
|
}
|
|
}
|
|
|
|
class Consumed {
|
|
int? amount;
|
|
String? timestamp;
|
|
|
|
Consumed({this.amount, this.timestamp});
|
|
|
|
factory Consumed.fromJson(Map<String, dynamic> json) {
|
|
return Consumed(
|
|
amount: json['amount'],
|
|
timestamp: json['timestamp'],
|
|
);
|
|
}
|
|
}
|