File tree Expand file tree Collapse file tree 3 files changed +52
-6
lines changed
Expand file tree Collapse file tree 3 files changed +52
-6
lines changed Original file line number Diff line number Diff line change 1+ import 'package:aha_client/src/api/util/xml_converter.dart' ;
2+ import 'package:freezed_annotation/freezed_annotation.dart' ;
3+ import 'package:xml/xml.dart' ;
4+
5+ part 'device_list_infos.freezed.dart' ;
6+
7+ @freezed
8+ class DeviceList with _$DeviceList {
9+ static const XmlTypeConverter <DeviceList > converter =
10+ _DeviceListTypeConverter ();
11+
12+ const factory DeviceList ({
13+ required String version,
14+ required String fwversion,
15+ required List <Device > devices,
16+ }) = _DeviceList ;
17+
18+ factory DeviceList .fromXml (XmlElement element) {
19+ throw UnimplementedError ();
20+ }
21+
22+ void toXml (XmlBuilder builder) {
23+ builder.element (
24+ 'devicelist' ,
25+ attributes: {
26+ 'version' : version,
27+ 'fwversion' : fwversion,
28+ },
29+ );
30+ }
31+ }
32+
33+ @freezed
34+ class Device with _$Device {
35+ const factory Device () = _Device ;
36+ }
37+
38+ class _DeviceListTypeConverter extends SimpleXmlTypeConverter <DeviceList > {
39+ const _DeviceListTypeConverter ();
40+
41+ @override
42+ void buildXml (DeviceList data, XmlBuilder builder) => data.toXml (builder);
43+
44+ @override
45+ DeviceList parseXml (XmlElement element) => DeviceList .fromXml (element);
46+ }
Original file line number Diff line number Diff line change @@ -10,15 +10,15 @@ dependencies:
1010 chopper : ^4.0.1
1111 convert : ^3.0.1
1212 cryptography : ^2.0.2
13- freezed_annotation : ^0.14.3
14- http : ^0.13.3
13+ freezed_annotation : ^0.15.0
14+ http : ^0.13.4
1515 meta : ^1.7.0
1616 xml : ^5.2.0
1717
1818dev_dependencies :
19- build_runner : ^2.1.2
20- chopper_generator : ^4.0.1
21- freezed : ^0.14.2
19+ build_runner : ^2.1.4
20+ chopper_generator : ^4.0.2
21+ freezed : ^0.15.0+1
2222 lint : ^1.7.2
23- test : ^1.16.0
23+ test : ^1.19.2
2424
You can’t perform that action at this time.
0 commit comments