style: Migrate to very_good_analysis
This commit is contained in:
@@ -1,40 +1,44 @@
|
||||
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 MoxdnsLinuxPlugin extends MoxdnsPlatform {
|
||||
|
||||
MoxdnsLinuxPlugin() : _channel = const MethodChannel('me.polynom.moxdns_linux'), super();
|
||||
final MethodChannel _channel;
|
||||
|
||||
MoxdnsLinuxPlugin() : _channel = MethodChannel("me.polynom.moxdns_linux"), super();
|
||||
|
||||
static void registerWith() {
|
||||
print("MoxdnsLinuxPlugin: Registering implementation");
|
||||
print('MoxdnsLinuxPlugin: Registering implementation');
|
||||
MoxdnsPlugin.platform = MoxdnsLinuxPlugin();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<SrvRecord>> srvQuery(String domain, bool dnssec) async {
|
||||
try {
|
||||
final List<dynamic> results = await _channel.invokeMethod("srvQuery", {
|
||||
"domain": domain,
|
||||
"dnssec": dnssec
|
||||
});
|
||||
// TODO(PapaTutuWawa): Handle the result being null
|
||||
final results = (await _channel.invokeMethod<List<dynamic>>('srvQuery', {
|
||||
'domain': domain,
|
||||
'dnssec': dnssec
|
||||
}))!;
|
||||
final records = List<SrvRecord>.empty(growable: true);
|
||||
for (var record in results) {
|
||||
for (final record in results) {
|
||||
if (record == null) {
|
||||
continue;
|
||||
}
|
||||
final rr = Map<String, dynamic>.from(record);
|
||||
records.add(SrvRecord(
|
||||
rr["target"]!,
|
||||
rr["port"]! as int,
|
||||
rr["priority"]! as int,
|
||||
rr["weight"]! as int
|
||||
));
|
||||
final rr = Map<String, String>.from(record as Map<String, String>);
|
||||
records.add(
|
||||
SrvRecord(
|
||||
rr['target']!,
|
||||
rr['port']! as int,
|
||||
rr['priority']! as int,
|
||||
rr['weight']! as int,
|
||||
),
|
||||
);
|
||||
}
|
||||
return records;
|
||||
} on PlatformException catch(e) {
|
||||
print("moxdns_linux: $e");
|
||||
print('moxdns_linux: $e');
|
||||
return const [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'moxdns_linux_platform_interface.dart';
|
||||
import 'package:moxdns_linux/moxdns_linux_platform_interface.dart';
|
||||
|
||||
/// An implementation of [MoxdnsLinuxPlatform] that uses method channels.
|
||||
class MethodChannelMoxdnsLinux extends MoxdnsLinuxPlatform {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:moxdns_linux/moxdns_linux_method_channel.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
import 'moxdns_linux_method_channel.dart';
|
||||
|
||||
abstract class MoxdnsLinuxPlatform extends PlatformInterface {
|
||||
/// Constructs a MoxdnsLinuxPlatform.
|
||||
MoxdnsLinuxPlatform() : super(token: _token);
|
||||
|
||||
Reference in New Issue
Block a user