style: Lint using very_good_analysis
This commit is contained in:
@@ -0,0 +1 @@
|
||||
include: ../../analysis_options.yaml
|
||||
@@ -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';
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,15 +12,16 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
moxlib:
|
||||
hosted: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
version: 0.1.4
|
||||
moxplatform:
|
||||
hosted: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
version: 0.1.11
|
||||
|
||||
moxlib:
|
||||
hosted: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
version: 0.1.4
|
||||
plugin_platform_interface: 2.1.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
very_good_analysis: 2.4.0
|
||||
|
||||
Reference in New Issue
Block a user