From 03dd111dd026cefaf5cfada39e3342d31b71848d Mon Sep 17 00:00:00 2001 From: Joel Winarske Date: Thu, 5 Sep 2024 15:42:22 -0700 Subject: Flutter SDK 3.24.1 -update packages -format files -fix analyze issues Change-Id: I9eb84f1bca7623ce676695904f172aff127c8ced Signed-off-by: Joel Winarske (cherry picked from commit 15093ee4880d535c65faed929801c2d79d1a212c) --- .gitignore | 12 +--- lib/config.dart | 45 +++++++------ lib/main.dart | 1 - lib/provider.dart | 6 +- lib/vehicle-signals/vehicle_status_provider.dart | 1 + lib/vehicle-signals/vss_client.dart | 44 +++++------- lib/vehicle-signals/vss_path.dart | 11 +-- lib/vehicle-signals/vss_provider.dart | 86 +++++++++++++----------- pubspec.yaml | 26 +++---- 9 files changed, 115 insertions(+), 117 deletions(-) diff --git a/.gitignore b/.gitignore index 93d6136..fdbd765 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related *.iml @@ -18,7 +19,7 @@ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ @@ -30,12 +31,6 @@ .pub-cache/ .pub/ /build/ -/engine_sdk/ -libapp.so -pubspec.lock - -# Web related -lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols @@ -48,5 +43,4 @@ app.*.map.json /android/app/profile /android/app/release -# the linux folder should be present when building for AGL -linux/ +.desktop-homescreen diff --git a/lib/config.dart b/lib/config.dart index aac3af8..b8a3d05 100644 --- a/lib/config.dart +++ b/lib/config.dart @@ -17,8 +17,13 @@ class KuksaConfig { static int defaultPort = 55555; static String defaultCaCertPath = '/etc/kuksa-val/CA.pem'; - KuksaConfig({required this.hostname, required this.port, required this.authorization, - required this.use_tls, required this.ca_certificate, required this.tls_server_name}); + KuksaConfig( + {required this.hostname, + required this.port, + required this.authorization, + required this.use_tls, + required this.ca_certificate, + required this.tls_server_name}); } // NOTE: This may need to be changed to a FutureProvider to avoid slowing @@ -49,7 +54,7 @@ final kuksaConfigProvider = Provider((ref) { debugPrint("Reading authorization token $s"); try { token = File(s).readAsStringSync(); - } on Exception catch(_) { + } on Exception catch (_) { print("ERROR: Could not read authorization token file $token"); token = ""; } @@ -63,8 +68,7 @@ final kuksaConfigProvider = Provider((ref) { bool use_tls = false; if (yamlMap.containsKey('use-tls')) { var value = yamlMap['use-tls']; - if (value is bool) - use_tls = value; + if (value is bool) use_tls = value; } //debugPrint("Use TLS = $use_tls"); @@ -75,7 +79,7 @@ final kuksaConfigProvider = Provider((ref) { } try { ca_cert = File(ca_path).readAsBytesSync(); - } on Exception catch(_) { + } on Exception catch (_) { print("ERROR: Could not read CA certificate file $ca_path"); ca_cert = []; } @@ -87,22 +91,19 @@ final kuksaConfigProvider = Provider((ref) { } return KuksaConfig( - hostname: hostname, - port: port, - authorization: token, - use_tls: use_tls, - ca_certificate: ca_cert, - tls_server_name: tls_server_name - ); - } on Exception catch(_) { + hostname: hostname, + port: port, + authorization: token, + use_tls: use_tls, + ca_certificate: ca_cert, + tls_server_name: tls_server_name); + } on Exception catch (_) { return KuksaConfig( - hostname: KuksaConfig.defaultHostname, - port: KuksaConfig.defaultPort, - authorization: "", - use_tls: false, - ca_certificate: [], - tls_server_name: "" - ); + hostname: KuksaConfig.defaultHostname, + port: KuksaConfig.defaultPort, + authorization: "", + use_tls: false, + ca_certificate: [], + tls_server_name: ""); } }); - diff --git a/lib/main.dart b/lib/main.dart index 9717055..e9d7bd1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_cluster_dashboard/screen/home.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; diff --git a/lib/provider.dart b/lib/provider.dart index c96c8e4..e082bf0 100644 --- a/lib/provider.dart +++ b/lib/provider.dart @@ -78,7 +78,11 @@ double calculateDistance(point1, point2) { double halfCosLatDiff = cos((point2.latitude - point1.latitude) * p) / 2; double halfCosLngDiff = cos((point2.longitude - point1.longitude) * p) / 2; - double dist = 0.5 - halfCosLatDiff + cos(point1.latitude * p) * cos(point2.latitude * p) * (0.5 - halfCosLngDiff); + double dist = 0.5 - + halfCosLatDiff + + cos(point1.latitude * p) * + cos(point2.latitude * p) * + (0.5 - halfCosLngDiff); return 12742 * asin(sqrt(dist)); } diff --git a/lib/vehicle-signals/vehicle_status_provider.dart b/lib/vehicle-signals/vehicle_status_provider.dart index da593cb..86edaf7 100644 --- a/lib/vehicle-signals/vehicle_status_provider.dart +++ b/lib/vehicle-signals/vehicle_status_provider.dart @@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; enum DistanceUnit { kilometers, miles } + enum TemperatureUnit { celsius, fahrenheit } class VehicleStatus { diff --git a/lib/vehicle-signals/vss_client.dart b/lib/vehicle-signals/vss_client.dart index e416d87..4a44a81 100644 --- a/lib/vehicle-signals/vss_client.dart +++ b/lib/vehicle-signals/vss_client.dart @@ -1,7 +1,4 @@ // SPDX-License-Identifier: Apache-2.0 -import 'dart:io'; -import 'package:meta/meta.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:grpc/grpc.dart'; import 'package:flutter_cluster_dashboard/generated/kuksa/val/v1/val.pbgrpc.dart'; @@ -17,14 +14,17 @@ abstract class VssClient { // Extenders will likely override this final List signals = []; - VssClient({required this.config, required this.channel, required this.stub, required this.ref}); + VssClient( + {required this.config, + required this.channel, + required this.stub, + required this.ref}); // Abstract method extenders must implement void handleSignalUpdates(EntryUpdate update); void run() async { - if (signals.isEmpty) - return; + if (signals.isEmpty) return; var request = SubscribeRequest(); for (var i = 0; i < signals.length; i++) { @@ -38,13 +38,13 @@ abstract class VssClient { try { Map metadata = {}; if (config.authorization.isNotEmpty) { - metadata = {'authorization': "Bearer ${config.authorization}" }; + metadata = {'authorization': "Bearer ${config.authorization}"}; } - var responseStream = stub.subscribe(request, options: CallOptions(metadata: metadata)); + var responseStream = + stub.subscribe(request, options: CallOptions(metadata: metadata)); await for (var response in responseStream) { for (var update in response.updates) { - if (!(update.hasEntry() && update.entry.hasPath())) - continue; + if (!(update.hasEntry() && update.entry.hasPath())) continue; handleSignalUpdates(update); } } @@ -54,44 +54,37 @@ abstract class VssClient { } void setUint32(String path, int value, [bool actuator = true]) async { - var dp = Datapoint() - ..uint32 = value; + var dp = Datapoint()..uint32 = value; set(path, dp, actuator); } void setInt32(String path, int value, [bool actuator = true]) async { - var dp = Datapoint() - ..int32 = value; + var dp = Datapoint()..int32 = value; set(path, dp, actuator); } void setBool(String path, bool value, [bool actuator = true]) async { - var dp = Datapoint() - ..bool_12 = value; + var dp = Datapoint()..bool_12 = value; set(path, dp, actuator); } void setString(String path, String value, [bool actuator = true]) async { - var dp = Datapoint() - ..string = value; + var dp = Datapoint()..string = value; set(path, dp, actuator); } void setFloat(String path, double value, [bool actuator = true]) async { - var dp = Datapoint() - ..float = value; + var dp = Datapoint()..float = value; set(path, dp, actuator); } void setDouble(String path, double value, [bool actuator = true]) async { - var dp = Datapoint() - ..double_18 = value; + var dp = Datapoint()..double_18 = value; set(path, dp, actuator); } void set(String path, Datapoint dp, bool actuator) async { - var entry = DataEntry() - ..path = path; + var entry = DataEntry()..path = path; var update = EntryUpdate(); if (actuator) { entry.actuatorTarget = dp; @@ -105,9 +98,8 @@ abstract class VssClient { request.updates.add(update); Map metadata = {}; if (config.authorization.isNotEmpty) { - metadata = {'authorization': "Bearer ${config.authorization}" }; + metadata = {'authorization': "Bearer ${config.authorization}"}; } await stub.set(request, options: CallOptions(metadata: metadata)); } - } diff --git a/lib/vehicle-signals/vss_path.dart b/lib/vehicle-signals/vss_path.dart index 047ad18..dd2bff1 100644 --- a/lib/vehicle-signals/vss_path.dart +++ b/lib/vehicle-signals/vss_path.dart @@ -6,7 +6,8 @@ class VSSPath { static const String vehicleEngineRPM = "Vehicle.Powertrain.CombustionEngine.Speed"; - static const String vehicleFuelLevel = "Vehicle.Powertrain.FuelSystem.RelativeLevel"; + static const String vehicleFuelLevel = + "Vehicle.Powertrain.FuelSystem.RelativeLevel"; static const String vehicleCoolantTemp = "Vehicle.Powertrain.CombustionEngine.ECT"; @@ -28,16 +29,18 @@ class VSSPath { static const String vehicleHighBeamOn = "Vehicle.Body.Lights.Beam.High.IsOn"; - static const String vehicleParkingLightOn = "Vehicle.Body.Lights.Parking.IsOn"; + static const String vehicleParkingLightOn = + "Vehicle.Body.Lights.Parking.IsOn"; - static const String vehicleHazardLightOn = "Vehicle.Body.Lights.Hazard.IsSignaling"; + static const String vehicleHazardLightOn = + "Vehicle.Body.Lights.Hazard.IsSignaling"; static const String vehicleTraveledDistance = "Vehicle.TraveledDistance"; static const String vehicleTrunkLocked = "Vehicle.Body.Trunk.Rear.IsLocked"; static const String vehicleTrunkOpen = "Vehicle.Body.Trunk.Rear.IsOpen"; - + // \"normal\",\"sport\",\"economy\",\"snow\",\"rain\"] static const String vehiclePerformanceMode = "Vehicle.Powertrain.Transmission.PerformanceMode"; diff --git a/lib/vehicle-signals/vss_provider.dart b/lib/vehicle-signals/vss_provider.dart index 5c62b96..b6c7036 100644 --- a/lib/vehicle-signals/vss_provider.dart +++ b/lib/vehicle-signals/vss_provider.dart @@ -1,11 +1,8 @@ // SPDX-License-Identifier: Apache-2.0 -import 'dart:io'; -import 'package:meta/meta.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:grpc/grpc.dart'; import 'package:flutter_cluster_dashboard/generated/kuksa/val/v1/val.pbgrpc.dart'; -import 'package:flutter_cluster_dashboard/generated/kuksa/val/v1/types.pb.dart'; import 'package:flutter_cluster_dashboard/config.dart'; import 'package:flutter_cluster_dashboard/vehicle-signals/vss_client.dart'; import 'package:flutter_cluster_dashboard/vehicle-signals/vss_path.dart'; @@ -14,37 +11,41 @@ import 'package:flutter_cluster_dashboard/vehicle-signals/vehicle_status_provide class DashboardVssClient extends VssClient { @override final List signals = [ - VSSPath.vehicleSpeed, - VSSPath.vehicleEngineRPM, - VSSPath.vehicleFuelLevel, - VSSPath.vehicleCoolantTemp, - VSSPath.vehicleAmbientAirTemperature, - VSSPath.vehicleLeftIndicator, - VSSPath.vehicleRightIndicator, - VSSPath.vehicleHazardLightOn, - VSSPath.vehicleHighBeamOn, - VSSPath.vehicleLowBeamOn, - VSSPath.vehicleSelectedGear, - VSSPath.vehiclePerformanceMode, - VSSPath.vehicleParkingLightOn, - VSSPath.vehicleTrunkLocked, - VSSPath.vehicleTrunkOpen, - VSSPath.vehicleMIL, - VSSPath.vehicleCruiseControlError, - VSSPath.vehicleCruiseControlSpeedSet, - VSSPath.vehicleCruiseControlActive, - VSSPath.vehicleBatteryChargingStatus, - VSSPath.vehicleDistanceUnit, - VSSPath.vehicleTemperatureUnit, - VSSPath.steeringCruiseEnable, - VSSPath.steeringCruiseSet, - VSSPath.steeringCruiseResume, - VSSPath.steeringCruiseCancel, - VSSPath.steeringInfo, - VSSPath.steeringLaneDepWarn - ]; + VSSPath.vehicleSpeed, + VSSPath.vehicleEngineRPM, + VSSPath.vehicleFuelLevel, + VSSPath.vehicleCoolantTemp, + VSSPath.vehicleAmbientAirTemperature, + VSSPath.vehicleLeftIndicator, + VSSPath.vehicleRightIndicator, + VSSPath.vehicleHazardLightOn, + VSSPath.vehicleHighBeamOn, + VSSPath.vehicleLowBeamOn, + VSSPath.vehicleSelectedGear, + VSSPath.vehiclePerformanceMode, + VSSPath.vehicleParkingLightOn, + VSSPath.vehicleTrunkLocked, + VSSPath.vehicleTrunkOpen, + VSSPath.vehicleMIL, + VSSPath.vehicleCruiseControlError, + VSSPath.vehicleCruiseControlSpeedSet, + VSSPath.vehicleCruiseControlActive, + VSSPath.vehicleBatteryChargingStatus, + VSSPath.vehicleDistanceUnit, + VSSPath.vehicleTemperatureUnit, + VSSPath.steeringCruiseEnable, + VSSPath.steeringCruiseSet, + VSSPath.steeringCruiseResume, + VSSPath.steeringCruiseCancel, + VSSPath.steeringInfo, + VSSPath.steeringLaneDepWarn + ]; - DashboardVssClient({required super.config, required super.channel, required super.stub, required super.ref}); + DashboardVssClient( + {required super.config, + required super.channel, + required super.stub, + required super.ref}); static String? numToGear(int? number) { switch (number) { @@ -163,7 +164,8 @@ class DashboardVssClient extends VssClient { break; case VSSPath.vehicleCruiseControlError: if (update.entry.value.hasBool_12()) { - vehicleStatus.update(isCruiseControlError: update.entry.value.bool_12); + vehicleStatus.update( + isCruiseControlError: update.entry.value.bool_12); } break; case VSSPath.vehicleCruiseControlSpeedSet: @@ -173,7 +175,8 @@ class DashboardVssClient extends VssClient { break; case VSSPath.vehicleCruiseControlActive: if (update.entry.value.hasBool_12()) { - vehicleStatus.update(isCruiseControlActive: update.entry.value.bool_12); + vehicleStatus.update( + isCruiseControlActive: update.entry.value.bool_12); } break; case VSSPath.vehicleBatteryChargingStatus: @@ -184,8 +187,7 @@ class DashboardVssClient extends VssClient { case VSSPath.vehicleDistanceUnit: if (update.entry.value.hasString()) { DistanceUnit unit = DistanceUnit.kilometers; - if (update.entry.value.string == "MILES") - unit = DistanceUnit.miles; + if (update.entry.value.string == "MILES") unit = DistanceUnit.miles; vehicleStatus.update(distanceUnit: unit); } break; @@ -266,17 +268,19 @@ final vssClientProvider = Provider((ref) { if (config.use_tls && config.ca_certificate.isNotEmpty) { print("Using TLS"); if (config.tls_server_name.isNotEmpty) - creds = ChannelCredentials.secure(certificates: config.ca_certificate, authority: config.tls_server_name); + creds = ChannelCredentials.secure( + certificates: config.ca_certificate, + authority: config.tls_server_name); else creds = ChannelCredentials.secure(certificates: config.ca_certificate); } else { creds = ChannelCredentials.insecure(); } final channel = ClientChannel(config.hostname, - port: config.port, - options: ChannelOptions(credentials: creds)); + port: config.port, options: ChannelOptions(credentials: creds)); final stub = VALClient(channel); - return DashboardVssClient(config: config, channel: channel, stub: stub, ref: ref); + return DashboardVssClient( + config: config, channel: channel, stub: stub, ref: ref); }); diff --git a/pubspec.yaml b/pubspec.yaml index 60c514b..d1d1853 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,33 +6,33 @@ version: 1.0.0+1 # Dart SDK version environment: - sdk: ">=2.18.0 <3.0.0" + sdk: ">=3.5.0 <4.0.0" dependencies: flutter: sdk: flutter # packages used - flutter_riverpod: ^1.0.4 - flutter_hooks: ^0.18.5 - hooks_riverpod: ^1.0.4 - flutter_map: ^2.2.0 - latlong2: ^0.8.1 - intl: ^0.17.0 - http: ^0.13.5 - yaml: ^3.1.1 + flutter_riverpod: ^2.5.1 + flutter_hooks: ^0.20.5 + hooks_riverpod: ^2.5.2 + flutter_map: ^7.0.2 + latlong2: ^0.9.1 + intl: ^0.19.0 + http: ^1.2.2 + yaml: ^3.1.2 - grpc: ^3.0.0 - protobuf: ^2.1.0 + grpc: ^4.0.1 + protobuf: ^3.1.0 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.0 + flutter_lints: ^4.0.0 flutter: uses-material-design: true assets: - assets/ - assets/cert/ - - images/ \ No newline at end of file + - images/ -- cgit 1.2.3-korg