diff --git a/packages/moxdns_android/analysis_options.yaml b/packages/moxdns_android/analysis_options.yaml index a5744c1..b3a83ec 100644 --- a/packages/moxdns_android/analysis_options.yaml +++ b/packages/moxdns_android/analysis_options.yaml @@ -1,4 +1,8 @@ -include: package:flutter_lints/flutter.yaml - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +include: package:very_good_analysis/analysis_options.yaml +linter: + rules: + public_member_api_docs: false + lines_longer_than_80_chars: false + use_setters_to_change_properties: false + avoid_positional_boolean_parameters: false + avoid_bool_literals_in_conditional_expressions: false diff --git a/packages/moxdns_android/lib/moxdns_android.dart b/packages/moxdns_android/lib/moxdns_android.dart index 930d639..b94eb7a 100644 --- a/packages/moxdns_android/lib/moxdns_android.dart +++ b/packages/moxdns_android/lib/moxdns_android.dart @@ -1,37 +1,42 @@ -import "package:moxdns/moxdns.dart"; -import "package:moxdns_platform_interface/moxdns_platform_interface.dart"; -import "package:flutter/services.dart"; +// ignore_for_file: avoid_print +import 'package:flutter/services.dart'; +import 'package:moxdns/moxdns.dart'; +import 'package:moxdns_platform_interface/moxdns_platform_interface.dart'; class MoxdnsAndroidPlugin extends MoxdnsPlatform { + + MoxdnsAndroidPlugin() + : _channel = const MethodChannel('me.polynom.moxdns_android'), super(); final MethodChannel _channel; - - MoxdnsAndroidPlugin() : _channel = MethodChannel("me.polynom.moxdns_android"), super(); - + static void registerWith() { - print("MoxdnsAndroidPlugin: Registering implementation"); + print('MoxdnsAndroidPlugin: Registering implementation'); MoxdnsPlugin.platform = MoxdnsAndroidPlugin(); } @override Future> srvQuery(String domain, bool dnssec) async { try { - final List results = await _channel.invokeMethod("srvQuery", [ domain, dnssec ]); + // TODO(PapaTutuWawa): Check for null + final results = (await _channel.invokeMethod>('srvQuery', [ domain, dnssec ]))!; final records = List.empty(growable: true); - for (var record in results) { + for (final record in results) { if (record == null) { continue; } - final rr = Map.from(record); - records.add(SrvRecord( - rr["target"]!, - int.parse(rr["port"]!), - int.parse(rr["priority"]!), - int.parse(rr["weight"]!) - )); + final rr = Map.from(record as Map); + records.add( + SrvRecord( + rr['target']!, + int.parse(rr['port']!), + int.parse(rr['priority']!), + int.parse(rr['weight']!), + ), + ); } return records; } on PlatformException catch(e) { - print("moxdns_android: $e"); + print('moxdns_android: $e'); return const []; } } diff --git a/packages/moxdns_android/lib/moxdns_android_method_channel.dart b/packages/moxdns_android/lib/moxdns_android_method_channel.dart index 44bcf02..c609e2e 100644 --- a/packages/moxdns_android/lib/moxdns_android_method_channel.dart +++ b/packages/moxdns_android/lib/moxdns_android_method_channel.dart @@ -1,7 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; - -import 'moxdns_android_platform_interface.dart'; +import 'package:moxdns_android/moxdns_android_platform_interface.dart'; /// An implementation of [MoxdnsAndroidPlatform] that uses method channels. class MethodChannelMoxdnsAndroid extends MoxdnsAndroidPlatform { diff --git a/packages/moxdns_android/lib/moxdns_android_platform_interface.dart b/packages/moxdns_android/lib/moxdns_android_platform_interface.dart index c1bc75b..701c563 100644 --- a/packages/moxdns_android/lib/moxdns_android_platform_interface.dart +++ b/packages/moxdns_android/lib/moxdns_android_platform_interface.dart @@ -1,7 +1,6 @@ +import 'package:moxdns_android/moxdns_android_method_channel.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; -import 'moxdns_android_method_channel.dart'; - abstract class MoxdnsAndroidPlatform extends PlatformInterface { /// Constructs a MoxdnsAndroidPlatform. MoxdnsAndroidPlatform() : super(token: _token); diff --git a/packages/moxdns_android/pubspec.yaml b/packages/moxdns_android/pubspec.yaml index ecf2a65..ac782f5 100644 --- a/packages/moxdns_android/pubspec.yaml +++ b/packages/moxdns_android/pubspec.yaml @@ -11,7 +11,6 @@ environment: dependencies: flutter: sdk: flutter - plugin_platform_interface: 2.1.0 moxdns: hosted: https://pub.polynom.me @@ -20,10 +19,13 @@ dependencies: hosted: https://pub.polynom.me version: 0.1.1 + plugin_platform_interface: 2.1.0 + dev_dependencies: + flutter_lints: ^2.0.0 flutter_test: sdk: flutter - flutter_lints: ^2.0.0 + very_good_analysis: 2.4.0 flutter: plugin: