style: Lint using very_good_analysis

This commit is contained in:
2022-09-06 14:08:36 +02:00
parent acd186e0b6
commit 3aad6b617d
30 changed files with 231 additions and 254 deletions

View File

@@ -1,29 +1,8 @@
import "package:moxplatform_platform_interface/src/isolate.dart";
import "package:moxplatform_platform_interface/src/isolate_stub.dart";
import "package:moxplatform_platform_interface/src/media.dart";
import "package:moxplatform_platform_interface/src/media_stub.dart";
import "package:plugin_platform_interface/plugin_platform_interface.dart";
library moxplatform_platform_interface;
abstract class MoxplatformInterface extends PlatformInterface {
/// Constructs a MyPluginPlatform.
MoxplatformInterface() : super(token: _token);
static final Object _token = Object();
static IsolateHandler _handler = StubIsolateHandler();
static MediaScannerImplementation _media = StubMediaScannerImplementation();
static IsolateHandler get handler => _handler;
static set handler(IsolateHandler instance) {
_handler = instance;
}
static MediaScannerImplementation get media => _media;
static set media(MediaScannerImplementation instance) {
_media = instance;
}
/// Return the current platform name.
Future<String?> getPlatformName();
}
export 'src/interface.dart';
export 'src/isolate.dart';
export 'src/isolate_stub.dart';
export 'src/media.dart';
export 'src/media_stub.dart';
export 'src/service.dart';

View File

@@ -0,0 +1,17 @@
import 'package:moxplatform_platform_interface/src/isolate.dart';
import 'package:moxplatform_platform_interface/src/isolate_stub.dart';
import 'package:moxplatform_platform_interface/src/media.dart';
import 'package:moxplatform_platform_interface/src/media_stub.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
abstract class MoxplatformInterface extends PlatformInterface {
MoxplatformInterface() : super(token: _token);
static final Object _token = Object();
static IsolateHandler handler = StubIsolateHandler();
static MediaScannerImplementation media = StubMediaScannerImplementation();
/// Return the current platform name.
Future<String?> getPlatformName();
}

View File

@@ -1,4 +1,4 @@
import "package:moxlib/awaitabledatasender.dart";
import 'package:moxlib/awaitabledatasender.dart';
/// A class abstracting the interaction between the UI isolate and the background
/// service, which is either a regular isolate or an Android foreground service.
@@ -6,17 +6,17 @@ import "package:moxlib/awaitabledatasender.dart";
abstract class IsolateHandler {
/// Start the background service.
/// [entrypoint] is the entrypoint that is run inside the new isolate.
/// [handeUiEvent] is a handler function that is called when the isolate receives data from the UI.
/// [handleUIEvent] is a handler function that is called when the isolate receives data from the UI.
/// [handleIsolateEvent] is a handler function that is called when the UI receives data from the service.
Future<void> start(
Future<void> Function() entrypoint,
Future<void> Function(Map<String, dynamic>? data) handleUIEvent,
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent,
);
/// Make sure that the UI event handler is registered without starting the isolate.
Future<void> attach(
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent,
);
/// Return true if the background service is running. False if it's not.

View File

@@ -1,5 +1,5 @@
import "package:moxlib/awaitabledatasender.dart";
import "package:moxplatform_platform_interface/src/isolate.dart";
import 'package:moxlib/awaitabledatasender.dart';
import 'package:moxplatform_platform_interface/src/isolate.dart';
class StubDataSender extends AwaitableDataSender {
StubDataSender() : super();
@@ -9,24 +9,25 @@ class StubDataSender extends AwaitableDataSender {
}
class StubIsolateHandler extends IsolateHandler {
final StubDataSender _sender;
StubIsolateHandler() : _sender = StubDataSender();
final StubDataSender _sender;
@override
Future<void> attach(
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent,
) async {
print("STUB ATTACHED!!!!!!");
// ignore: avoid_print
print('STUB ATTACHED!!!!!!');
}
@override
Future<void> start(
Future<void> Function() entrypoint,
Future<void> Function(Map<String, dynamic>? data) handleUIEvent,
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent
Future<void> Function(Map<String, dynamic>? data) handleIsolateEvent,
) async {
print("STUB STARTED!!!!!!");
// ignore: avoid_print
print('STUB STARTED!!!!!!');
}
@override

View File

@@ -1,4 +1,5 @@
/// Wrapper around platform-specific media scanning
// ignore: one_member_abstracts
abstract class MediaScannerImplementation {
/// Let the platform-specific media scanner scan the file at [path].
void scanFile(String path);

View File

@@ -1,4 +1,4 @@
import "package:moxplatform_platform_interface/src/media.dart";
import 'package:moxplatform_platform_interface/src/media.dart';
class StubMediaScannerImplementation extends MediaScannerImplementation {
@override

View File

@@ -1,4 +1,4 @@
import "package:moxplatform/types.dart";
import 'package:moxplatform/moxplatform.dart';
abstract class BackgroundService {
/// Set the notification of the background service, if available
@@ -12,6 +12,6 @@ abstract class BackgroundService {
/// data.
void init(
Future<void> Function() entrypoint,
Future<void> Function(Map<String, dynamic>? data) handleEvent
Future<void> Function(Map<String, dynamic>? data) handleEvent,
);
}