Skip to content

Commit a6bb224

Browse files
committed
Handle most linter errors from flutter analyze.
1 parent 3461942 commit a6bb224

15 files changed

+39
-22
lines changed

analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
analyzer:
1+
include: package:lints/recommended.yaml
2+

example/lib/screens/api_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class _ApiScreenState extends State<ApiScreen> {
148148
);
149149
}
150150

151-
void onUnityMessage(message) {
151+
void onUnityMessage(dynamic message) {
152152
print('Received message from unity: ${message.toString()}');
153153
}
154154

@@ -162,7 +162,7 @@ class _ApiScreenState extends State<ApiScreen> {
162162
}
163163

164164
// Callback that connects the created controller to the unity controller
165-
void onUnityCreated(controller) {
165+
void onUnityCreated(UnityWidgetController controller) {
166166
_unityWidgetController = controller;
167167
}
168168
}

example/lib/screens/loader_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ class _LoaderScreenState extends State<LoaderScreen> {
8282
);
8383
}
8484

85-
void onUnityMessage(message) {
85+
void onUnityMessage(dynamic message) {
8686
print('Received message from unity: ${message.toString()}');
8787
}
8888

8989
// Callback that connects the created controller to the unity controller
90-
void onUnityCreated(controller) {
90+
void onUnityCreated(UnityWidgetController controller) {
9191
_unityWidgetController = controller;
9292
}
9393
}

example/lib/screens/no_interaction_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class _NoInteractionScreenState extends State<NoInteractionScreen> {
7575
);
7676
}
7777

78-
void onUnityMessage(message) {
78+
void onUnityMessage(dynamic message) {
7979
print('Received message from unity: ${message.toString()}');
8080
}
8181

@@ -89,7 +89,7 @@ class _NoInteractionScreenState extends State<NoInteractionScreen> {
8989
}
9090

9191
// Callback that connects the created controller to the unity controller
92-
void _onUnityCreated(controller) {
92+
void _onUnityCreated(UnityWidgetController controller) {
9393
controller.resume();
9494
_unityWidgetController = controller;
9595
}

example/lib/screens/orientation_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ class _OrientationScreenState extends State<OrientationScreen> {
9797
);
9898
}
9999

100-
void onUnityMessage(message) {
100+
void onUnityMessage(dynamic message) {
101101
print('Received message from unity: ${message.toString()}');
102102
}
103103

104104
// Callback that connects the created controller to the unity controller
105-
void onUnityCreated(controller) {
105+
void onUnityCreated(UnityWidgetController controller) {
106106
_unityWidgetController = controller;
107107
}
108108
}

example/lib/screens/simple_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class _SimpleScreenState extends State<SimpleScreen> {
9191
);
9292
}
9393

94-
void onUnityMessage(message) {
94+
void onUnityMessage(dynamic message) {
9595
print('Received message from unity: ${message.toString()}');
9696
}
9797

@@ -105,7 +105,7 @@ class _SimpleScreenState extends State<SimpleScreen> {
105105
}
106106

107107
// Callback that connects the created controller to the unity controller
108-
void _onUnityCreated(controller) {
108+
void _onUnityCreated(UnityWidgetController controller) {
109109
controller.resume();
110110
_unityWidgetController = controller;
111111
}

lib/src/facade_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
typedef void UnityCreatedCallback(UnityWidgetController controller);
1+
typedef UnityCreatedCallback = void Function(UnityWidgetController controller);
22

33
abstract class UnityWidgetController {
44
static dynamic webRegistrar;

lib/src/facade_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class UnityWidget extends StatefulWidget {
7777
final TextDirection? layoutDirection;
7878

7979
@override
80-
_UnityWidgetState createState() => _UnityWidgetState();
80+
State<UnityWidget> createState() => _UnityWidgetState();
8181
}
8282

8383
class _UnityWidgetState extends State<UnityWidget> {

lib/src/helpers/misc.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class UnknownUnityIDError extends Error {
1212
/// Message describing the assertion error.
1313
final Object? message;
1414

15+
@override
1516
String toString() {
1617
if (message != null) {
1718
return "Unknown unity ID $unityId: ${Error.safeToString(message)}";
@@ -20,8 +21,8 @@ class UnknownUnityIDError extends Error {
2021
}
2122
}
2223

23-
typedef void UnityMessageCallback(dynamic handler);
24+
typedef UnityMessageCallback = void Function(dynamic handler);
2425

25-
typedef void UnitySceneChangeCallback(SceneLoaded? message);
26+
typedef UnitySceneChangeCallback = void Function(SceneLoaded? message);
2627

27-
typedef void UnityUnloadCallback();
28+
typedef UnityUnloadCallback = void Function();

lib/src/io/device_method.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class MethodChannelUnityWidget extends UnityWidgetPlatform {
158158
bool? unityWebSource,
159159
String? unitySrcUrl,
160160
}) {
161+
// ignore: no_leading_underscores_for_local_identifiers
161162
final String _viewType = 'plugin.xraph.com/unity_view';
162163

163164
if (useAndroidViewSurf != null) useAndroidViewSurface = useAndroidViewSurf;

0 commit comments

Comments
 (0)