From 2da2edc06159d6112c36af330f875b53dc8e543b Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Tue, 27 Sep 2022 09:11:35 +0200 Subject: [PATCH] chore: fix app linting --- app/lib/common/models/medication/guideline.dart | 6 ++---- app/lib/common/models/medication/medication.dart | 2 +- app/lib/common/pages/medications/medication.dart | 8 +------- app/lib/common/utilities/hive_utils.dart | 7 +------ app/lib/reports/pages/reports.dart | 2 -- app/lib/settings/chdp_state.dart | 6 +++--- app/lib/settings/pages/settings.dart | 1 - 7 files changed, 8 insertions(+), 24 deletions(-) diff --git a/app/lib/common/models/medication/guideline.dart b/app/lib/common/models/medication/guideline.dart index 75415227c..c7d6c34f9 100644 --- a/app/lib/common/models/medication/guideline.dart +++ b/app/lib/common/models/medication/guideline.dart @@ -1,8 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:hive/hive.dart'; -import '../../module.dart'; - part 'guideline.g.dart'; @HiveType(typeId: 9) @@ -70,7 +68,7 @@ class Guideline { @override int get hashCode { - return hashValues( + return Object.hash( implication, recommendation, warningLevel, @@ -115,7 +113,7 @@ class Phenotype { } @override - int get hashCode => hashValues(geneResult.name, geneSymbol.name); + int get hashCode => Object.hash(geneResult.name, geneSymbol.name); } @HiveType(typeId: 11) diff --git a/app/lib/common/models/medication/medication.dart b/app/lib/common/models/medication/medication.dart index 3cae5d3f6..5092f4abd 100644 --- a/app/lib/common/models/medication/medication.dart +++ b/app/lib/common/models/medication/medication.dart @@ -77,7 +77,7 @@ class MedicationWithGuidelines { guidelines.contentEquals(other.guidelines); @override - int get hashCode => hashValues(name, guidelines); + int get hashCode => Object.hash(name, guidelines); } List medicationsFromHTTPResponse(Response resp) { diff --git a/app/lib/common/pages/medications/medication.dart b/app/lib/common/pages/medications/medication.dart index 8e2b2b405..94b4e384a 100644 --- a/app/lib/common/pages/medications/medication.dart +++ b/app/lib/common/pages/medications/medication.dart @@ -2,18 +2,12 @@ import 'dart:io'; -import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import '../../l10n.dart'; -import '../../models/module.dart'; -import '../../theme.dart'; +import '../../../common/module.dart'; import '../../utilities/pdf_utils.dart'; -import '../../widgets/module.dart'; import 'cubit.dart'; import 'widgets/module.dart'; -import '../../../common/module.dart'; class MedicationPage extends StatelessWidget { const MedicationPage( diff --git a/app/lib/common/utilities/hive_utils.dart b/app/lib/common/utilities/hive_utils.dart index cd619afb0..6cd69c17f 100644 --- a/app/lib/common/utilities/hive_utils.dart +++ b/app/lib/common/utilities/hive_utils.dart @@ -1,11 +1,6 @@ -import 'dart:convert'; - // import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:hive/hive.dart'; -// TODO The D4L SDK depends on an older version of tink (1.2, but up to 1.4 in testing) -// while flutter_secure_storage depends on 1.5. This causes problems, so -// use a dummy key here until someone figures out what to do +// TODO(0teh): D4L SDK and flutter_secure_storage dependency conflict, https://github.com/hpi-dhc/PharMe/issues/445. Future> retrieveExistingOrGenerateKey() async { return List.filled(32, 0); // const secureStorage = FlutterSecureStorage(); diff --git a/app/lib/reports/pages/reports.dart b/app/lib/reports/pages/reports.dart index d35299ade..c471cdd2a 100644 --- a/app/lib/reports/pages/reports.dart +++ b/app/lib/reports/pages/reports.dart @@ -1,5 +1,3 @@ -import 'package:flutter/services.dart'; - import '../../common/module.dart'; import 'cubit.dart'; diff --git a/app/lib/settings/chdp_state.dart b/app/lib/settings/chdp_state.dart index d13c7b6e0..8f4833829 100644 --- a/app/lib/settings/chdp_state.dart +++ b/app/lib/settings/chdp_state.dart @@ -58,7 +58,7 @@ class _ChdpState extends State with WidgetsBindingObserver { try { isLoggedIn = await platform.invokeMethod('isLoggedIn'); } on PlatformException catch (e) { - debugPrint('platform exception in getIsLoggedIn'); + debugPrint('platform exception in getIsLoggedIn: ${e.toString()}'); } setState(() { @@ -70,7 +70,7 @@ class _ChdpState extends State with WidgetsBindingObserver { try { await platform.invokeMethod('login'); } on PlatformException catch (e) { - debugPrint('platform exception in login'); + debugPrint('platform exception in login: ${e.toString()}'); } } @@ -78,7 +78,7 @@ class _ChdpState extends State with WidgetsBindingObserver { try { await platform.invokeMethod('logout'); } on PlatformException catch (e) { - debugPrint('platform exception in logout'); + debugPrint('platform exception in logout: ${e.toString()}'); } } } diff --git a/app/lib/settings/pages/settings.dart b/app/lib/settings/pages/settings.dart index 3edf430b6..241ef2a9b 100644 --- a/app/lib/settings/pages/settings.dart +++ b/app/lib/settings/pages/settings.dart @@ -1,5 +1,4 @@ import 'dart:io'; -import 'dart:math'; import '../../common/module.dart'; import '../chdp_state.dart';