feat: Provide a much cleaner Dart API

This commit is contained in:
2023-09-10 13:28:12 +02:00
parent 2299b766cc
commit d6ce224956
18 changed files with 344 additions and 207 deletions

View File

@@ -20,10 +20,10 @@ class MoxxyBackgroundServiceApi {
Future<int> getHandler() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.getHandler', codec,
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.getHandler',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(null) as List<Object?>?;
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
@@ -47,10 +47,10 @@ class MoxxyBackgroundServiceApi {
Future<String> getExtraData() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.getExtraData', codec,
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.getExtraData',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(null) as List<Object?>?;
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
@@ -74,7 +74,8 @@ class MoxxyBackgroundServiceApi {
Future<void> setNotificationBody(String arg_body) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.setNotificationBody', codec,
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.setNotificationBody',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_body]) as List<Object?>?;
@@ -96,7 +97,8 @@ class MoxxyBackgroundServiceApi {
Future<void> sendData(String arg_data) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.sendData', codec,
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.sendData',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_data]) as List<Object?>?;
@@ -120,8 +122,7 @@ class MoxxyBackgroundServiceApi {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.moxxy_native.MoxxyBackgroundServiceApi.stop', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(null) as List<Object?>?;
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',

View File

@@ -22,8 +22,8 @@ class MoxxyServiceApi {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.moxxy_native.MoxxyServiceApi.configure', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_handle, arg_extraData]) as List<Object?>?;
final List<Object?>? replyList = await channel
.send(<Object?>[arg_handle, arg_extraData]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
@@ -44,8 +44,7 @@ class MoxxyServiceApi {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.moxxy_native.MoxxyServiceApi.isRunning', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(null) as List<Object?>?;
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
@@ -71,8 +70,7 @@ class MoxxyServiceApi {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.moxxy_native.MoxxyServiceApi.start', codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(null) as List<Object?>?;
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',