Browse Source

[flutter_local_notifications] done

merge-requests/3/head
Vitaliy Zarubin 2 years ago
parent
commit
83012df5b5
  1. 4
      packages/flutter_local_notifications/flutter_local_notifications_aurora/README.md
  2. 23
      packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/CMakeLists.txt
  3. 38
      packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/flutter_local_notifications_aurora_plugin.cpp
  4. 23
      packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/include/flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h
  5. BIN
      packages/flutter_local_notifications/flutter_local_notifications_aurora/data/preview.gif
  6. 4
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.cpp
  7. 2
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugins.cmake
  8. 51
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/lib/main.dart
  9. 27
      packages/flutter_local_notifications/flutter_local_notifications_aurora/example/test/widget_test.dart
  10. 57
      packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora.dart
  11. 17
      packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_method_channel.dart
  12. 29
      packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_platform_interface.dart
  13. 100
      packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/org_freedesktop_notifications.dart
  14. 4
      packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml
  15. 24
      packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_method_channel_test.dart
  16. 29
      packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_test.dart

4
packages/flutter_local_notifications/flutter_local_notifications_aurora/README.md

@ -12,3 +12,7 @@ dependencies:
flutter_local_notifications_aurora:
path: # path to folder with plugin
```
### Preview example
![preview.png](data%2Fpreview.gif)

23
packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/CMakeLists.txt

@ -1,23 +0,0 @@
cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME flutter_local_notifications_aurora)
set(PLUGIN_NAME flutter_local_notifications_aurora_platform_plugin)
project(${PROJECT_NAME} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-psabi")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
find_package(PkgConfig REQUIRED)
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder)
add_library(${PLUGIN_NAME} SHARED flutter_local_notifications_aurora_plugin.cpp)
set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder)
target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL)

38
packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/flutter_local_notifications_aurora_plugin.cpp

@ -1,38 +0,0 @@
#include <flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h>
#include <flutter/method-channel.h>
#include <sys/utsname.h>
void FlutterLocalNotificationsAuroraPlugin::RegisterWithRegistrar(PluginRegistrar &registrar)
{
registrar.RegisterMethodChannel("flutter_local_notifications_aurora",
MethodCodecType::Standard,
[this](const MethodCall &call) { this->onMethodCall(call); });
}
void FlutterLocalNotificationsAuroraPlugin::onMethodCall(const MethodCall &call)
{
const auto &method = call.GetMethod();
if (method == "getPlatformVersion") {
onGetPlatformVersion(call);
return;
}
unimplemented(call);
}
void FlutterLocalNotificationsAuroraPlugin::onGetPlatformVersion(const MethodCall &call)
{
utsname uname_data{};
uname(&uname_data);
std::string preamble = "Aurora (Linux): ";
std::string version = preamble + uname_data.version;
call.SendSuccessResponse(version);
}
void FlutterLocalNotificationsAuroraPlugin::unimplemented(const MethodCall &call)
{
call.SendSuccessResponse(nullptr);
}

23
packages/flutter_local_notifications/flutter_local_notifications_aurora/aurora/include/flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h

@ -1,23 +0,0 @@
#ifndef FLUTTER_PLUGIN_FLUTTER_LOCAL_NOTIFICATIONS_AURORA_PLUGIN_H
#define FLUTTER_PLUGIN_FLUTTER_LOCAL_NOTIFICATIONS_AURORA_PLUGIN_H
#include <flutter/plugin-interface.h>
#ifdef PLUGIN_IMPL
#define PLUGIN_EXPORT __attribute__((visibility("default")))
#else
#define PLUGIN_EXPORT
#endif
class PLUGIN_EXPORT FlutterLocalNotificationsAuroraPlugin final : public PluginInterface
{
public:
void RegisterWithRegistrar(PluginRegistrar &registrar) override;
private:
void onMethodCall(const MethodCall &call);
void onGetPlatformVersion(const MethodCall &call);
void unimplemented(const MethodCall &call);
};
#endif /* FLUTTER_PLUGIN_FLUTTER_LOCAL_NOTIFICATIONS_AURORA_PLUGIN_H */

BIN
packages/flutter_local_notifications/flutter_local_notifications_aurora/data/preview.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

4
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugin_registrant.cpp

@ -5,12 +5,12 @@
// clang-format off
#include <flutter/application.h>
#include <flutter_local_notifications_aurora/flutter_local_notifications_aurora_plugin.h>
#include <package_info_plus_aurora/package_info_plus_aurora_plugin.h>
#include "generated_plugin_registrant.h"
void RegisterPlugins() {
Application::RegisterPlugins({
std::make_shared<FlutterLocalNotificationsAuroraPlugin>(),
std::make_shared<PackageInfoPlusAuroraPlugin>(),
});
}

2
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/aurora/flutter/generated_plugins.cmake

@ -15,7 +15,7 @@ function(add_library TARGET)
endfunction()
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST
flutter_local_notifications_aurora
package_info_plus_aurora
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

51
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/lib/main.dart

@ -15,6 +15,7 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State<MyApp> {
final notificationID = 1;
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
@ -25,24 +26,62 @@ class _MyAppState extends State<MyApp> {
Future<void> _showNotification() async {
await flutterLocalNotificationsPlugin.show(
166,
notificationID,
"Title notification",
"My long body text notification",
null,
);
}
Future<void> _cancelNotification() async {
await flutterLocalNotificationsPlugin.cancel(notificationID);
}
@override
Widget build(BuildContext context) {
const textStyleWhite = TextStyle(fontSize: 18, color: Colors.white);
const spaceMedium = SizedBox(height: 20);
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
title: const Text('Example flutter_local_notifications'),
),
body: Center(
child: ElevatedButton(
onPressed: _showNotification,
child: const Text('Show notification'),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
child: Center(
child: Column(
children: [
// Info
Container(
padding: const EdgeInsets.all(20),
decoration: const BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
child: const Text(
'Demo application demonstration implementation of flutter_local_notifications',
style: textStyleWhite,
textAlign: TextAlign.center,
),
),
const SizedBox(height: 30),
ElevatedButton(
onPressed: _showNotification,
child: const Text('Show notification'),
),
spaceMedium,
ElevatedButton(
onPressed: _cancelNotification,
child: const Text('Cancel notification'),
)
],
),
),
),
),
),

27
packages/flutter_local_notifications/flutter_local_notifications_aurora/example/test/widget_test.dart

@ -1,27 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_local_notifications_aurora_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
});
}

57
packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora.dart

@ -1,10 +1,9 @@
import 'dart:async';
import 'package:dbus/dbus.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_local_notifications_aurora/org_freedesktop_notifications.dart';
import 'dart:async';
import 'package:flutter_local_notifications_platform_interface/flutter_local_notifications_platform_interface.dart';
import 'flutter_local_notifications_aurora_platform_interface.dart';
import 'package:package_info_plus/package_info_plus.dart';
class FlutterLocalNotificationsAurora
extends FlutterLocalNotificationsPlatform {
@ -14,10 +13,8 @@ class FlutterLocalNotificationsAurora
FlutterLocalNotificationsAurora();
}
final Map<int, int> ids = {};
final Map<int, List<int>> auroraIDs = {};
/// dart pub global activate dbus
/// dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml -o lib/org_freedesktop_notifications.dart
@override
Future<void> show(
int id,
@ -25,42 +22,42 @@ class FlutterLocalNotificationsAurora
String? body, {
String? payload,
}) async {
var client = DBusClient.session();
final appName = (await PackageInfo.fromPlatform()).appName;
final client = DBusClient.session();
final object = OrgFreedesktopNotifications(
client,
'org.freedesktop.Notifications',
DBusObjectPath('/org/freedesktop/Notifications'));
final auroraID = await object.callNotify(
'app_name',
auroraIDs[id] = auroraIDs[id] ?? [];
auroraIDs[id]!.add(await object.callNotify(
appName,
0,
'image://theme/icon-l-play',
title ?? 'Title',
body ?? 'Body',
' ',
title ?? '',
body ?? '',
[],
{},
4000,
);
ids[id] = auroraID;
-1,
));
await client.close();
}
@override
Future<void> cancel(int id) async {
var client = DBusClient.session();
var object = OrgFreedesktopNotifications(
client,
'org.freedesktop.Notifications',
DBusObjectPath('/org/freedesktop/Notifications'));
await object.callCloseNotification(ids[id] ?? 0);
await client.close();
}
Future<String?> getPlatformVersion() {
return FlutterLocalNotificationsAuroraPlatform.instance
.getPlatformVersion();
final ids = auroraIDs[id] ?? [];
if (auroraIDs.isNotEmpty) {
final client = DBusClient.session();
final object = OrgFreedesktopNotifications(
client,
'org.freedesktop.Notifications',
DBusObjectPath('/org/freedesktop/Notifications'));
for (final auroraID in ids) {
await object.callCloseNotification(auroraID);
}
ids.remove(id);
await client.close();
}
}
}

17
packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_method_channel.dart

@ -1,17 +0,0 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'flutter_local_notifications_aurora_platform_interface.dart';
/// An implementation of [FlutterLocalNotificationsAuroraPlatform] that uses method channels.
class MethodChannelFlutterLocalNotificationsAurora extends FlutterLocalNotificationsAuroraPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('flutter_local_notifications_aurora');
@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
}

29
packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/flutter_local_notifications_aurora_platform_interface.dart

@ -1,29 +0,0 @@
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'flutter_local_notifications_aurora_method_channel.dart';
abstract class FlutterLocalNotificationsAuroraPlatform extends PlatformInterface {
/// Constructs a FlutterLocalNotificationsAuroraPlatform.
FlutterLocalNotificationsAuroraPlatform() : super(token: _token);
static final Object _token = Object();
static FlutterLocalNotificationsAuroraPlatform _instance = MethodChannelFlutterLocalNotificationsAurora();
/// The default instance of [FlutterLocalNotificationsAuroraPlatform] to use.
///
/// Defaults to [MethodChannelFlutterLocalNotificationsAurora].
static FlutterLocalNotificationsAuroraPlatform get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [FlutterLocalNotificationsAuroraPlatform] when
/// they register themselves.
static set instance(FlutterLocalNotificationsAuroraPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<String?> getPlatformVersion() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
}

100
packages/flutter_local_notifications/flutter_local_notifications_aurora/lib/org_freedesktop_notifications.dart

@ -1,6 +1,8 @@
// This file was generated using the following command and may be overwritten.
// dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml
// dart pub global activate dbus
// dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml -o lib/org_freedesktop_notifications.dart
import 'package:dbus/dbus.dart';
/// Signal data for org.freedesktop.Notifications.NotificationClosed.
@ -8,7 +10,13 @@ class OrgFreedesktopNotificationsNotificationClosed extends DBusSignal {
int get id => values[0].asUint32();
int get reason => values[1].asUint32();
OrgFreedesktopNotificationsNotificationClosed(DBusSignal signal) : super(sender: signal.sender, path: signal.path, interface: signal.interface, name: signal.name, values: signal.values);
OrgFreedesktopNotificationsNotificationClosed(DBusSignal signal)
: super(
sender: signal.sender,
path: signal.path,
interface: signal.interface,
name: signal.name,
values: signal.values);
}
/// Signal data for org.freedesktop.Notifications.ActionInvoked.
@ -16,42 +24,106 @@ class OrgFreedesktopNotificationsActionInvoked extends DBusSignal {
int get id => values[0].asUint32();
String get action_key => values[1].asString();
OrgFreedesktopNotificationsActionInvoked(DBusSignal signal) : super(sender: signal.sender, path: signal.path, interface: signal.interface, name: signal.name, values: signal.values);
OrgFreedesktopNotificationsActionInvoked(DBusSignal signal)
: super(
sender: signal.sender,
path: signal.path,
interface: signal.interface,
name: signal.name,
values: signal.values);
}
class OrgFreedesktopNotifications extends DBusRemoteObject {
/// Stream of org.freedesktop.Notifications.NotificationClosed signals.
late final Stream<OrgFreedesktopNotificationsNotificationClosed> notificationClosed;
late final Stream<OrgFreedesktopNotificationsNotificationClosed>
notificationClosed;
/// Stream of org.freedesktop.Notifications.ActionInvoked signals.
late final Stream<OrgFreedesktopNotificationsActionInvoked> actionInvoked;
OrgFreedesktopNotifications(DBusClient client, String destination, DBusObjectPath path) : super(client, name: destination, path: path) {
notificationClosed = DBusRemoteObjectSignalStream(object: this, interface: 'org.freedesktop.Notifications', name: 'NotificationClosed', signature: DBusSignature('uu')).asBroadcastStream().map((signal) => OrgFreedesktopNotificationsNotificationClosed(signal));
OrgFreedesktopNotifications(
DBusClient client, String destination, DBusObjectPath path)
: super(client, name: destination, path: path) {
notificationClosed = DBusRemoteObjectSignalStream(
object: this,
interface: 'org.freedesktop.Notifications',
name: 'NotificationClosed',
signature: DBusSignature('uu'))
.asBroadcastStream()
.map((signal) => OrgFreedesktopNotificationsNotificationClosed(signal));
actionInvoked = DBusRemoteObjectSignalStream(object: this, interface: 'org.freedesktop.Notifications', name: 'ActionInvoked', signature: DBusSignature('us')).asBroadcastStream().map((signal) => OrgFreedesktopNotificationsActionInvoked(signal));
actionInvoked = DBusRemoteObjectSignalStream(
object: this,
interface: 'org.freedesktop.Notifications',
name: 'ActionInvoked',
signature: DBusSignature('us'))
.asBroadcastStream()
.map((signal) => OrgFreedesktopNotificationsActionInvoked(signal));
}
/// Invokes org.freedesktop.Notifications.Notify()
Future<int> callNotify(String app_name, int replaces_id, String app_icon, String summary, String body, List<String> actions, Map<String, DBusValue> hints, int timeout, {bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async {
var result = await callMethod('org.freedesktop.Notifications', 'Notify', [DBusString(app_name), DBusUint32(replaces_id), DBusString(app_icon), DBusString(summary), DBusString(body), DBusArray.string(actions), DBusDict.stringVariant(hints), DBusInt32(timeout)], replySignature: DBusSignature('u'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization);
Future<int> callNotify(
String app_name,
int replaces_id,
String app_icon,
String summary,
String body,
List<String> actions,
Map<String, DBusValue> hints,
int timeout,
{bool noAutoStart = false,
bool allowInteractiveAuthorization = false}) async {
var result = await callMethod(
'org.freedesktop.Notifications',
'Notify',
[
DBusString(app_name),
DBusUint32(replaces_id),
DBusString(app_icon),
DBusString(summary),
DBusString(body),
DBusArray.string(actions),
DBusDict.stringVariant(hints),
DBusInt32(timeout)
],
replySignature: DBusSignature('u'),
noAutoStart: noAutoStart,
allowInteractiveAuthorization: allowInteractiveAuthorization);
return result.returnValues[0].asUint32();
}
/// Invokes org.freedesktop.Notifications.CloseNotification()
Future<void> callCloseNotification(int id, {bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async {
await callMethod('org.freedesktop.Notifications', 'CloseNotification', [DBusUint32(id)], replySignature: DBusSignature(''), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization);
Future<void> callCloseNotification(int id,
{bool noAutoStart = false,
bool allowInteractiveAuthorization = false}) async {
await callMethod(
'org.freedesktop.Notifications', 'CloseNotification', [DBusUint32(id)],
replySignature: DBusSignature(''),
noAutoStart: noAutoStart,
allowInteractiveAuthorization: allowInteractiveAuthorization);
}
/// Invokes org.freedesktop.Notifications.GetCapabilities()
Future<List<String>> callGetCapabilities({bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async {
var result = await callMethod('org.freedesktop.Notifications', 'GetCapabilities', [], replySignature: DBusSignature('as'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization);
Future<List<String>> callGetCapabilities(
{bool noAutoStart = false,
bool allowInteractiveAuthorization = false}) async {
var result = await callMethod(
'org.freedesktop.Notifications', 'GetCapabilities', [],
replySignature: DBusSignature('as'),
noAutoStart: noAutoStart,
allowInteractiveAuthorization: allowInteractiveAuthorization);
return result.returnValues[0].asStringArray().toList();
}
/// Invokes org.freedesktop.Notifications.GetServerInformation()
Future<List<DBusValue>> callGetServerInformation({bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async {
var result = await callMethod('org.freedesktop.Notifications', 'GetServerInformation', [], replySignature: DBusSignature('ssss'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization);
Future<List<DBusValue>> callGetServerInformation(
{bool noAutoStart = false,
bool allowInteractiveAuthorization = false}) async {
var result = await callMethod(
'org.freedesktop.Notifications', 'GetServerInformation', [],
replySignature: DBusSignature('ssss'),
noAutoStart: noAutoStart,
allowInteractiveAuthorization: allowInteractiveAuthorization);
return result.returnValues;
}
}

4
packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml

@ -13,11 +13,10 @@ dependencies:
dbus: ^0.7.8
plugin_platform_interface: ^2.0.2
flutter_local_notifications_platform_interface: ^7.0.0
package_info_plus: 4.0.0
package_info_plus: ^4.0.0
package_info_plus_aurora:
path: ../../package_info_plus/package_info_plus_aurora
dev_dependencies:
flutter_test:
sdk: flutter
@ -27,5 +26,4 @@ flutter:
plugin:
platforms:
aurora:
pluginClass: FlutterLocalNotificationsAuroraPlugin
dartPluginClass: FlutterLocalNotificationsAurora

24
packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_method_channel_test.dart

@ -1,24 +0,0 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_local_notifications_aurora/flutter_local_notifications_aurora_method_channel.dart';
void main() {
MethodChannelFlutterLocalNotificationsAurora platform = MethodChannelFlutterLocalNotificationsAurora();
const MethodChannel channel = MethodChannel('flutter_local_notifications_aurora');
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
return '42';
});
});
tearDown(() {
channel.setMockMethodCallHandler(null);
});
test('getPlatformVersion', () async {
expect(await platform.getPlatformVersion(), '42');
});
}

29
packages/flutter_local_notifications/flutter_local_notifications_aurora/test/flutter_local_notifications_aurora_test.dart

@ -1,29 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_local_notifications_aurora/flutter_local_notifications_aurora.dart';
import 'package:flutter_local_notifications_aurora/flutter_local_notifications_aurora_platform_interface.dart';
import 'package:flutter_local_notifications_aurora/flutter_local_notifications_aurora_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockFlutterLocalNotificationsAuroraPlatform
with MockPlatformInterfaceMixin
implements FlutterLocalNotificationsAuroraPlatform {
@override
Future<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final FlutterLocalNotificationsAuroraPlatform initialPlatform = FlutterLocalNotificationsAuroraPlatform.instance;
test('$MethodChannelFlutterLocalNotificationsAurora is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelFlutterLocalNotificationsAurora>());
});
test('getPlatformVersion', () async {
FlutterLocalNotificationsAurora flutterLocalNotificationsAuroraPlugin = FlutterLocalNotificationsAurora();
MockFlutterLocalNotificationsAuroraPlatform fakePlatform = MockFlutterLocalNotificationsAuroraPlatform();
FlutterLocalNotificationsAuroraPlatform.instance = fakePlatform;
expect(await flutterLocalNotificationsAuroraPlugin.getPlatformVersion(), '42');
});
}
Loading…
Cancel
Save