diff --git a/example/lib/main.dart b/example/lib/main.dart
index 742680e..602f5aa 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -42,7 +42,7 @@ class Button extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(4.0),
- child: RaisedButton(
+ child: ElevatedButton(
onPressed: function,
child: Text(
title,
diff --git a/example/pubspec.lock b/example/pubspec.lock
index beea1e5..bd30585 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -1,62 +1,48 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
- archive:
- dependency: transitive
- description:
- name: archive
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.13"
- args:
- dependency: transitive
- description:
- name: args
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.4.1"
+ version: "2.6.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
- charcode:
+ version: "2.1.0"
+ characters:
dependency: transitive
description:
- name: charcode
+ name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.3"
- collection:
+ version: "1.1.0"
+ charcode:
dependency: transitive
description:
- name: collection
+ name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.14.12"
- convert:
+ version: "1.2.0"
+ clock:
dependency: transitive
description:
- name: convert
+ name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.1"
- crypto:
+ version: "1.1.0"
+ collection:
dependency: transitive
description:
- name: crypto
+ name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.4"
+ version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
@@ -64,6 +50,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
+ fake_async:
+ dependency: transitive
+ description:
+ name: fake_async
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
@@ -74,34 +67,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
- image:
- dependency: transitive
- description:
- name: image
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.12"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.6"
+ version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.8"
+ version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.6.4"
+ version: "1.8.0"
pedantic:
dependency: transitive
description:
@@ -109,27 +95,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
- petitparser:
- dependency: transitive
- description:
- name: petitparser
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.4.0"
presentation_displays:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
- version: "0.1.7"
- quiver:
- dependency: transitive
- description:
- name: quiver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.3"
+ version: "0.2.0"
sky_engine:
dependency: transitive
description: flutter
@@ -141,63 +113,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.9.3"
+ version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.5"
+ version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.15"
+ version: "0.3.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.6"
+ version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.8"
- xml:
- dependency: transitive
- description:
- name: xml
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.6.1"
+ version: "2.1.0"
sdks:
- dart: ">=2.7.0 <3.0.0"
+ dart: ">=2.12.0 <3.0.0"
flutter: ">=1.10.0"
diff --git a/lib/display.dart b/lib/display.dart
index c40749f..4c6c7e8 100644
--- a/lib/display.dart
+++ b/lib/display.dart
@@ -110,13 +110,13 @@ class Display {
/// Each logical display has a unique id.
/// The default display has id [DEFAULT_DISPLAY]
///
- int displayId = DEFAULT_DISPLAY;
+ int? displayId = DEFAULT_DISPLAY;
/// Returns a combination of flags that describe the capabilities of the display.
/// @return The display flags.
///
/// See [FLAG_SUPPORTS_PROTECTED_BUFFERS], [FLAG_SECURE], [FLAG_PRIVATE]
- int flag;
+ int? flag;
/// Returns the rotation of the screen from its "natural" orientation.
/// The returned value may be [ROTATION_0]
@@ -130,7 +130,7 @@ class Display {
/// degrees counter-clockwise, to compensate rendering will be rotated by
/// 90 degrees clockwise and thus the returned value here will be
/// [ROTATION_90].
- int rotation;
+ int? rotation;
/// Gets the name of the display.
///
@@ -138,7 +138,7 @@ class Display {
///
///
/// @return The display's name.
- String name;
+ String? name;
Display({this.displayId, this.flag, this.name, this.rotation});
}
diff --git a/lib/displays_manager.dart b/lib/displays_manager.dart
index 250ba03..cfddeeb 100644
--- a/lib/displays_manager.dart
+++ b/lib/displays_manager.dart
@@ -32,7 +32,7 @@ const String DISPLAY_CATEGORY_PRESENTATION =
/// Provide you with the method for you to work with [SecondaryDisplay].
class DisplayManager {
final _displayChannel = "presentation_displays_plugin";
- MethodChannel _displayMethodChannel;
+ MethodChannel? _displayMethodChannel;
DisplayManager() {
_displayMethodChannel = MethodChannel(_displayChannel);
@@ -52,14 +52,14 @@ class DisplayManager {
/// @return An array containing all displays sorted by order of preference.
///
/// See [DISPLAY_CATEGORY_PRESENTATION]
- FutureOr> getDisplays({String category}) async {
- List origins = await jsonDecode(await _displayMethodChannel
- ?.invokeMethod(_listDisplay, category)) ??
+ Future> getDisplays({String? category}) async {
+ List origins = await jsonDecode((await _displayMethodChannel
+ ?.invokeMethod(_listDisplay, category))) ??
[];
List displays = [];
origins.forEach((element) {
Map map = jsonDecode(jsonEncode(element));
- displays.add(displayFromJson(map));
+ displays.add(displayFromJson(map as Map));
});
return displays;
}
@@ -73,10 +73,10 @@ class DisplayManager {
///
/// @return The display's name.
/// May be null.
- FutureOr getNameByDisplayId(int displayId, {String category}) async {
- List displays = await getDisplays(category: category) ?? [];
+ Future getNameByDisplayId(int displayId, {String? category}) async {
+ List displays = await getDisplays(category: category);
- String name;
+ String? name;
displays.forEach((element) {
if (element.displayId == displayId) name = element.name;
});
@@ -92,9 +92,9 @@ class DisplayManager {
///
/// @return The display's name
/// May be null.
- FutureOr getNameByIndex(int index, {String category}) async {
- List displays = await getDisplays(category: category) ?? [];
- String name;
+ Future getNameByIndex(int index, {String? category}) async {
+ List displays = await getDisplays(category: category);
+ String? name;
if (index >= 0 && index <= displays.length) name = displays[index].name;
return name;
}
@@ -108,8 +108,8 @@ class DisplayManager {
///
///
/// return [Future] about the status has been display or not
- Future showSecondaryDisplay(
- {@required int displayId, @required String routerName}) {
+ Future? showSecondaryDisplay(
+ {required int displayId, required String routerName}) {
return _displayMethodChannel?.invokeMethod(
_showPresentation,
"{"
@@ -170,7 +170,7 @@ class DisplayManager {
///
///
/// return [Future] the value to determine whether or not the data has been transferred successfully
- Future transferDataToPresentation(dynamic arguments) {
+ Future? transferDataToPresentation(dynamic arguments) {
return _displayMethodChannel?.invokeMethod(
_transferDataToPresentation, arguments);
}
diff --git a/lib/secondary_display.dart b/lib/secondary_display.dart
index 13b726f..b29558e 100644
--- a/lib/secondary_display.dart
+++ b/lib/secondary_display.dart
@@ -10,13 +10,13 @@ typedef ArgumentsCallback = Function(dynamic arguments);
/// [SecondaryDisplay.callback] instance of [ArgumentsCallback] to receive data transmitted from the [DisplayManager].
/// [SecondaryDisplay.child] child widget of secondary display
class SecondaryDisplay extends StatefulWidget {
- SecondaryDisplay({@required this.callback, this.child});
+ SecondaryDisplay({required this.callback, this.child});
/// instance of [ArgumentsCallback] to receive data transmitted from the [DisplaysManager].
final ArgumentsCallback callback;
/// Your Flutter UI on Presentation Screen
- final Widget child;
+ final Widget? child;
@override
_SecondaryDisplayState createState() => _SecondaryDisplayState();
@@ -24,7 +24,7 @@ class SecondaryDisplay extends StatefulWidget {
class _SecondaryDisplayState extends State {
final _presentationChannel = "presentation_displays_plugin_engine";
- MethodChannel _presentationMethodChannel;
+ late MethodChannel _presentationMethodChannel;
@override
void initState() {
diff --git a/pubspec.lock b/pubspec.lock
index b9272b7..dab9ba7 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1,62 +1,55 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
- archive:
- dependency: transitive
- description:
- name: archive
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.13"
- args:
- dependency: transitive
- description:
- name: args
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.4.1"
+ version: "2.6.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.0"
+ characters:
+ dependency: transitive
+ description:
+ name: characters
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.3"
- collection:
+ version: "1.2.0"
+ clock:
dependency: transitive
description:
- name: collection
+ name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.14.12"
- convert:
+ version: "1.1.0"
+ collection:
dependency: transitive
description:
- name: convert
+ name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.1"
- crypto:
+ version: "1.15.0"
+ fake_async:
dependency: transitive
description:
- name: crypto
+ name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.4"
+ version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
@@ -67,34 +60,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
- image:
- dependency: transitive
- description:
- name: image
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.12"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.6"
+ version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.8"
+ version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.6.4"
+ version: "1.8.0"
pedantic:
dependency: "direct main"
description:
@@ -102,20 +88,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
- petitparser:
- dependency: transitive
- description:
- name: petitparser
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.4.0"
- quiver:
- dependency: transitive
- description:
- name: quiver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
@@ -127,63 +99,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.9.3"
+ version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.5"
+ version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.15"
+ version: "0.3.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.6"
+ version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.8"
- xml:
- dependency: transitive
- description:
- name: xml
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.6.1"
+ version: "2.1.0"
sdks:
- dart: ">=2.7.0 <3.0.0"
+ dart: ">=2.12.0 <3.0.0"
flutter: ">=1.10.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index db7b50c..910b7f0 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,11 +1,11 @@
name: presentation_displays
description: Flutter plugin supports to run on two screens. It's basically a tablet connected to another screen via an HDMI or Wireless
homepage: https://github.com/VNAPNIC/presentation-displays
-version: 0.1.8
+version: 0.2.0
author: vn.apnic@gmail.com
environment:
- sdk: ">=2.7.0 <3.0.0"
+ sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.10.0"
dependencies: