| 1 | import 'package:flutter/services.dart'; |
| 2 | import 'package:json_annotation/json_annotation.dart'; |
| 3 | import 'package:aero/constants/main.dart'; |
| 4 | |
| 5 | part 'wear_os.g.dart'; |
| 6 | |
| 7 | @JsonSerializable() |
| 8 | class WearOSDevice { |
| 9 | final String id; |
| 10 | final String displayName; |
| 11 | final bool isNearby; |
| 12 | |
| 13 | WearOSDevice({ |
| 14 | required this.id, |
| 15 | required this.displayName, |
| 16 | required this.isNearby, |
| 17 | }); |
| 18 | |
| 19 | factory WearOSDevice.fromJson( |
| 20 | toJson() => _$WearOSDeviceToJson( |
| 21 | } |
| 22 | |
| 23 | class WearOSService { |
| 24 | static const MethodChannel |
| 25 | |
| 26 | /// Get list of connected Wear OS devices |
| 27 | Future<List<WearOSDevice |
| 28 | try { |
| 29 | final List<Object |
| 30 | 'getConnectedWearables', |
| 31 | ); |
| 32 | final List<Map |
| 33 | return result.map((json) => |
| 34 | } on PlatformException catch (e) { |
| 35 | print('Error getting connected devices: ${e. |
| 36 | return []; |
| 37 | } |
| 38 | } |
| 39 | } |