Skip to content

Commit 0fcebf7

Browse files
committed
Fix warnings about passing values to type void.
1 parent a6bb224 commit 0fcebf7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/src/helpers/events.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ class UnityEvent<T> {
55
final int unityId;
66

77
/// The value wrapped by this event
8-
final T value;
8+
final T? value;
99

1010
/// Build a Unity Event, that relates a mapId with a given value.
1111
///
1212
/// The `unityId` is the id of the map that triggered the event.
1313
/// `value` may be `null` in events that don't transport any meaningful data.
14-
UnityEvent(this.unityId, this.value);
14+
UnityEvent(this.unityId, [this.value]);
1515
}
1616

1717
class UnitySceneLoadedEvent extends UnityEvent<SceneLoaded?> {
@@ -20,15 +20,15 @@ class UnitySceneLoadedEvent extends UnityEvent<SceneLoaded?> {
2020
}
2121

2222
class UnityLoadedEvent extends UnityEvent<void> {
23-
UnityLoadedEvent(int unityId, void value) : super(unityId, value);
23+
UnityLoadedEvent(int unityId) : super(unityId);
2424
}
2525

2626
class UnityUnLoadedEvent extends UnityEvent<void> {
27-
UnityUnLoadedEvent(int unityId, void value) : super(unityId, value);
27+
UnityUnLoadedEvent(int unityId) : super(unityId);
2828
}
2929

3030
class UnityCreatedEvent extends UnityEvent<void> {
31-
UnityCreatedEvent(int unityId, void value) : super(unityId, value);
31+
UnityCreatedEvent(int unityId) : super(unityId);
3232
}
3333

3434
class UnityMessageEvent extends UnityEvent<dynamic> {

lib/src/io/device_method.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ class MethodChannelUnityWidget extends UnityWidgetPlatform {
8686
_unityStreamController.add(UnityMessageEvent(unityId, call.arguments));
8787
break;
8888
case "events#onUnityUnloaded":
89-
_unityStreamController.add(UnityLoadedEvent(unityId, call.arguments));
89+
_unityStreamController.add(UnityLoadedEvent(unityId));
9090
break;
9191
case "events#onUnitySceneLoaded":
9292
_unityStreamController.add(UnitySceneLoadedEvent(
9393
unityId, SceneLoaded.fromMap(call.arguments)));
9494
break;
9595
case "events#onUnityCreated":
96-
_unityStreamController.add(UnityCreatedEvent(unityId, call.arguments));
96+
_unityStreamController.add(UnityCreatedEvent(unityId));
9797
break;
9898
default:
9999
throw UnimplementedError("Unimplemented ${call.method} method");

lib/src/web/web_unity_widget_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class WebUnityWidgetController extends UnityWidgetController {
107107
unityReady = true;
108108
unityPause = false;
109109

110-
_unityStreamController.add(UnityCreatedEvent(0, {}));
110+
_unityStreamController.add(UnityCreatedEvent(0));
111111
return;
112112
}
113113

0 commit comments

Comments
 (0)