I believe there's a bug in the example app:
Android, MainActivity:
MethodChannel(flutterEngine.dartExecutor, CHANNEL).setMethodCallHandler { call, result ->
if (call.method == "initialLink") {
if (startString != null) {
result.success(startString)
}
}
}
In most cases, the app is launched "normally" and not through a deep link, which means startString would be null.
if startString is null or if the method is not initialLink, no result will be sent to the Flutter end.
If the caller is using await, the code would block indefinitely.
In your Flutter code, you use then on the future, and therefore do not see the blocking issue:
_startUri().then(_onRedirected);
But if your code would have used async/await it would not have worked.
A possible solution would be to send a result in any case:
MethodChannel(flutterEngine.dartExecutor, CHANNEL).setMethodCallHandler { call, result ->
if (call.method == "initialLink") {
result.success(startString)
}
result.error(...)
}
-
|
MethodChannel(flutterEngine.dartExecutor, CHANNEL).setMethodCallHandler { call, result -> |
-
|
_startUri().then(_onRedirected); |
I believe there's a bug in the example app:
Android, MainActivity:
In most cases, the app is launched "normally" and not through a deep link, which means
startStringwould be null.if
startStringis null or if the method is not initialLink, no result will be sent to the Flutter end.If the caller is using
await, the code would block indefinitely.In your Flutter code, you use
thenon the future, and therefore do not see the blocking issue:But if your code would have used
async/awaitit would not have worked.A possible solution would be to send a result in any case:
appcues-flutter-plugin/example/android/app/src/main/kotlin/com/appcues/samples/flutter/MainActivity.kt
Line 25 in 68c35fb
appcues-flutter-plugin/example/lib/src/app.dart
Line 64 in 68c35fb