Files
UnityUDP/lib/models/project.dart

45 lines
900 B
Dart

import 'package:json_annotation/json_annotation.dart';
import 'udp_package.dart';
part 'project.g.dart';
@JsonSerializable()
class Project {
final String id;
final String name;
final String ipAddress;
final int port;
final List<UdpPackage> packages;
Project({
required this.id,
required this.name,
required this.ipAddress,
required this.port,
required this.packages,
});
factory Project.fromJson(Map<String, dynamic> json) =>
_$ProjectFromJson(json);
Map<String, dynamic> toJson() => _$ProjectToJson(this);
Project copyWith({
String? id,
String? name,
String? ipAddress,
int? port,
List<UdpPackage>? packages,
}) {
return Project(
id: id ?? this.id,
name: name ?? this.name,
ipAddress: ipAddress ?? this.ipAddress,
port: port ?? this.port,
packages: packages ?? this.packages,
);
}
}