diff --git a/analysis_options.yaml b/analysis_options.yaml index 9378852..451e8ad 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -7,6 +7,7 @@ linter: avoid_positional_boolean_parameters: false avoid_bool_literals_in_conditional_expressions: false file_names: false + one_member_abstracts: false analyzer: exclude: diff --git a/example/lib/main.dart b/example/lib/main.dart index 5445d15..5ad8582 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -55,11 +55,12 @@ class MyAppState extends State { ), TextButton( onPressed: () async { - final result = await MoxxyPickerApi().pickFiles(FilePickerType.image, false); + final result = await MoxxyPickerApi() + .pickFiles(FilePickerType.image, false); if (result.isEmpty) return; - final encDest = result.first! + '.enc'; - final decDest = result.first! + '.dec'; + final encDest = '${result.first!}.enc'; + final decDest = '${result.first!}.dec'; final encResult = await MoxxyCryptographyApi().encryptFile( result.first!, encDest, @@ -69,6 +70,7 @@ class MyAppState extends State { 'SHA-256', ); if (encResult == null) { + // ignore: avoid_print print('Failed to encrypt file'); return; } @@ -82,6 +84,7 @@ class MyAppState extends State { 'SHA-256', ); if (decResult == null) { + // ignore: avoid_print print('Failed to decrypt file'); return; } @@ -90,11 +93,9 @@ class MyAppState extends State { imagePath = decDest; }); }, - child: Text('Test cryptography'), + child: const Text('Test cryptography'), ), - - if (imagePath != null) - Image.file(File(imagePath!)), + if (imagePath != null) Image.file(File(imagePath!)), ], ), ), diff --git a/example/pigeon/cryptography.dart b/example/pigeon/cryptography.dart index e69de29..8b13789 100644 --- a/example/pigeon/cryptography.dart +++ b/example/pigeon/cryptography.dart @@ -0,0 +1 @@ + diff --git a/lib/pigeon/contacts.g.dart b/lib/pigeon/contacts.g.dart index 1deb5bb..7bdcbd4 100644 --- a/lib/pigeon/contacts.g.dart +++ b/lib/pigeon/contacts.g.dart @@ -25,12 +25,18 @@ class MoxxyContactsApi { static const MessageCodec codec = StandardMessageCodec(); - Future recordSentMessage(String arg_name, String arg_jid, String? arg_avatarPath, FallbackIconType arg_fallbackIcon) async { + Future recordSentMessage(String arg_name, String arg_jid, + String? arg_avatarPath, FallbackIconType arg_fallbackIcon) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.moxxy_native.MoxxyContactsApi.recordSentMessage', codec, + 'dev.flutter.pigeon.moxxy_native.MoxxyContactsApi.recordSentMessage', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_name, arg_jid, arg_avatarPath, arg_fallbackIcon.index]) as List?; + final List? replyList = await channel.send([ + arg_name, + arg_jid, + arg_avatarPath, + arg_fallbackIcon.index + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/lib/pigeon/cryptography.g.dart b/lib/pigeon/cryptography.g.dart index 0ec046f..c70be82 100644 --- a/lib/pigeon/cryptography.g.dart +++ b/lib/pigeon/cryptography.g.dart @@ -55,7 +55,7 @@ class _MoxxyCryptographyApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CryptographyResult.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -73,12 +73,25 @@ class MoxxyCryptographyApi { static const MessageCodec codec = _MoxxyCryptographyApiCodec(); - Future encryptFile(String arg_sourcePath, String arg_destPath, Uint8List arg_key, Uint8List arg_iv, CipherAlgorithm arg_algorithm, String arg_hashSpec) async { + Future encryptFile( + String arg_sourcePath, + String arg_destPath, + Uint8List arg_key, + Uint8List arg_iv, + CipherAlgorithm arg_algorithm, + String arg_hashSpec) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.moxxy_native.MoxxyCryptographyApi.encryptFile', codec, + 'dev.flutter.pigeon.moxxy_native.MoxxyCryptographyApi.encryptFile', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_sourcePath, arg_destPath, arg_key, arg_iv, arg_algorithm.index, arg_hashSpec]) as List?; + final List? replyList = await channel.send([ + arg_sourcePath, + arg_destPath, + arg_key, + arg_iv, + arg_algorithm.index, + arg_hashSpec + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -95,12 +108,25 @@ class MoxxyCryptographyApi { } } - Future decryptFile(String arg_sourcePath, String arg_destPath, Uint8List arg_key, Uint8List arg_iv, CipherAlgorithm arg_algorithm, String arg_hashSpec) async { + Future decryptFile( + String arg_sourcePath, + String arg_destPath, + Uint8List arg_key, + Uint8List arg_iv, + CipherAlgorithm arg_algorithm, + String arg_hashSpec) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.moxxy_native.MoxxyCryptographyApi.decryptFile', codec, + 'dev.flutter.pigeon.moxxy_native.MoxxyCryptographyApi.decryptFile', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_sourcePath, arg_destPath, arg_key, arg_iv, arg_algorithm.index, arg_hashSpec]) as List?; + final List? replyList = await channel.send([ + arg_sourcePath, + arg_destPath, + arg_key, + arg_iv, + arg_algorithm.index, + arg_hashSpec + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -117,12 +143,13 @@ class MoxxyCryptographyApi { } } - Future hashFile(String arg_sourcePath, String arg_hashSpec) async { + Future hashFile( + String arg_sourcePath, String arg_hashSpec) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.moxxy_native.MoxxyCryptographyApi.hashFile', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_sourcePath, arg_hashSpec]) as List?; + final List? replyList = await channel + .send([arg_sourcePath, arg_hashSpec]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/lib/pigeon/media.g.dart b/lib/pigeon/media.g.dart index 6031faa..9d2df22 100644 --- a/lib/pigeon/media.g.dart +++ b/lib/pigeon/media.g.dart @@ -18,12 +18,14 @@ class MoxxyMediaApi { static const MessageCodec codec = StandardMessageCodec(); - Future generateVideoThumbnail(String arg_src, String arg_dest, int arg_maxWidth) async { + Future generateVideoThumbnail( + String arg_src, String arg_dest, int arg_maxWidth) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.moxxy_native.MoxxyMediaApi.generateVideoThumbnail', codec, + 'dev.flutter.pigeon.moxxy_native.MoxxyMediaApi.generateVideoThumbnail', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_src, arg_dest, arg_maxWidth]) as List?; + final List? replyList = await channel + .send([arg_src, arg_dest, arg_maxWidth]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/lib/pigeon/platform.g.dart b/lib/pigeon/platform.g.dart index 1e3bd1b..a40b056 100644 --- a/lib/pigeon/platform.g.dart +++ b/lib/pigeon/platform.g.dart @@ -20,10 +20,10 @@ class MoxxyPlatformApi { Future getPersistentDataPath() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.moxxy_native.MoxxyPlatformApi.getPersistentDataPath', codec, + 'dev.flutter.pigeon.moxxy_native.MoxxyPlatformApi.getPersistentDataPath', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -47,10 +47,10 @@ class MoxxyPlatformApi { Future getCacheDataPath() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.moxxy_native.MoxxyPlatformApi.getCacheDataPath', codec, + 'dev.flutter.pigeon.moxxy_native.MoxxyPlatformApi.getCacheDataPath', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -74,10 +74,10 @@ class MoxxyPlatformApi { Future openBatteryOptimisationSettings() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.moxxy_native.MoxxyPlatformApi.openBatteryOptimisationSettings', codec, + 'dev.flutter.pigeon.moxxy_native.MoxxyPlatformApi.openBatteryOptimisationSettings', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -96,10 +96,10 @@ class MoxxyPlatformApi { Future isIgnoringBatteryOptimizations() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.moxxy_native.MoxxyPlatformApi.isIgnoringBatteryOptimizations', codec, + 'dev.flutter.pigeon.moxxy_native.MoxxyPlatformApi.isIgnoringBatteryOptimizations', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/pigeon/cryptography.dart b/pigeon/cryptography.dart index 9f786e2..208a6f3 100644 --- a/pigeon/cryptography.dart +++ b/pigeon/cryptography.dart @@ -3,7 +3,8 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( PigeonOptions( dartOut: 'lib/pigeon/cryptography.g.dart', - kotlinOut: 'android/src/main/kotlin/org/moxxy/moxxy_native/cryptography/CryptographyApi.kt', + kotlinOut: + 'android/src/main/kotlin/org/moxxy/moxxy_native/cryptography/CryptographyApi.kt', kotlinOptions: KotlinOptions( package: 'org.moxxy.moxxy_native.cryptography', ), @@ -24,11 +25,28 @@ class CryptographyResult { @HostApi() abstract class MoxxyCryptographyApi { @async - CryptographyResult? encryptFile(String sourcePath, String destPath, Uint8List key, Uint8List iv, CipherAlgorithm algorithm, String hashSpec); + CryptographyResult? encryptFile( + String sourcePath, + String destPath, + Uint8List key, + Uint8List iv, + CipherAlgorithm algorithm, + String hashSpec, + ); @async - CryptographyResult? decryptFile(String sourcePath, String destPath, Uint8List key, Uint8List iv, CipherAlgorithm algorithm, String hashSpec); + CryptographyResult? decryptFile( + String sourcePath, + String destPath, + Uint8List key, + Uint8List iv, + CipherAlgorithm algorithm, + String hashSpec, + ); @async - Uint8List? hashFile(String sourcePath, String hashSpec); + Uint8List? hashFile( + String sourcePath, + String hashSpec, + ); } diff --git a/pigeon/media.dart b/pigeon/media.dart index 994db5e..f98988b 100644 --- a/pigeon/media.dart +++ b/pigeon/media.dart @@ -3,13 +3,13 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( PigeonOptions( dartOut: 'lib/pigeon/media.g.dart', - kotlinOut: 'android/src/main/kotlin/org/moxxy/moxxy_native/media/MediaApi.kt', + kotlinOut: + 'android/src/main/kotlin/org/moxxy/moxxy_native/media/MediaApi.kt', kotlinOptions: KotlinOptions( package: 'org.moxxy.moxxy_native.media', ), ), ) - @HostApi() abstract class MoxxyMediaApi { bool generateVideoThumbnail(String src, String dest, int maxWidth); diff --git a/pigeon/notifications.dart b/pigeon/notifications.dart index 03407d1..678a43e 100644 --- a/pigeon/notifications.dart +++ b/pigeon/notifications.dart @@ -3,7 +3,8 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( PigeonOptions( dartOut: 'lib/pigeon/notifications.g.dart', - kotlinOut: 'android/src/main/kotlin/org/moxxy/moxxy_native/notifications/NotificationsApi.kt', + kotlinOut: + 'android/src/main/kotlin/org/moxxy/moxxy_native/notifications/NotificationsApi.kt', kotlinOptions: KotlinOptions( package: 'org.moxxy.moxxy_native.notifications', ), @@ -54,9 +55,16 @@ class NotificationMessage { } class MessagingNotification { - const MessagingNotification(this.title, this.id, this.jid, this.messages, - this.channelId, this.isGroupchat, this.extra, - {this.groupId}); + const MessagingNotification( + this.title, + this.id, + this.jid, + this.messages, + this.channelId, + this.isGroupchat, + this.extra, { + this.groupId, + }); /// The title of the conversation. final String title; @@ -91,8 +99,13 @@ enum NotificationIcon { class RegularNotification { const RegularNotification( - this.title, this.body, this.channelId, this.id, this.icon, - {this.groupId}); + this.title, + this.body, + this.channelId, + this.id, + this.icon, { + this.groupId, + }); /// The title of the notification. final String title; @@ -165,6 +178,7 @@ class NotificationGroup { final String description; } +// ignore: constant_identifier_names enum NotificationChannelImportance { MIN, HIGH, DEFAULT } class NotificationChannel { diff --git a/pigeon/picker.dart b/pigeon/picker.dart index 15b1c61..da2183b 100644 --- a/pigeon/picker.dart +++ b/pigeon/picker.dart @@ -3,13 +3,13 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( PigeonOptions( dartOut: 'lib/pigeon/picker.g.dart', - kotlinOut: 'android/src/main/kotlin/org/moxxy/moxxy_native/picker/PickerApi.kt', + kotlinOut: + 'android/src/main/kotlin/org/moxxy/moxxy_native/picker/PickerApi.kt', kotlinOptions: KotlinOptions( package: 'org.moxxy.moxxy_native.picker', ), ), ) - enum FilePickerType { /// Pick only image(s) image, diff --git a/pigeon/platform.dart b/pigeon/platform.dart index 2d39719..ed93216 100644 --- a/pigeon/platform.dart +++ b/pigeon/platform.dart @@ -3,13 +3,13 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( PigeonOptions( dartOut: 'lib/pigeon/platform.g.dart', - kotlinOut: 'android/src/main/kotlin/org/moxxy/moxxy_native/platform/PlatformApi.kt', + kotlinOut: + 'android/src/main/kotlin/org/moxxy/moxxy_native/platform/PlatformApi.kt', kotlinOptions: KotlinOptions( package: 'org.moxxy.moxxy_native.platform', ), ), ) - @HostApi() abstract class MoxxyPlatformApi { String getPersistentDataPath();