Skip to content

Commit a7482fd

Browse files
committed
Fix #1831: Run MethodChannel messages on UI Thread
1 parent c7d8e10 commit a7482fd

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

packages/stripe_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 10.2.1
2+
**Fixes**
3+
- Run method channel messages on UI Thread to prevent crash (#1831)
4+
15
## 10.2.0
26

37
**Features**
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package com.facebook.react.modules.core;
22

3+
import android.os.Handler;
4+
import android.os.Looper;
5+
36
import com.facebook.react.bridge.WritableMap;
47

58
import io.flutter.plugin.common.MethodChannel;
69

710
public class DeviceEventManagerModule {
811
public static class RCTDeviceEventEmitter {
12+
private Handler uiThreadHandler = new Handler(Looper.getMainLooper());
913

1014
private final MethodChannel channel;
1115

@@ -14,7 +18,7 @@ public RCTDeviceEventEmitter(MethodChannel channel) {
1418
}
1519

1620
public void emit(String eventName, WritableMap params) {
17-
channel.invokeMethod(eventName, params);
21+
uiThreadHandler.post(() -> channel.invokeMethod(eventName, params));
1822
}
1923
}
2024
}

packages/stripe_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: stripe_android
22
description: Stripe platform implementation for Android
3-
version: 10.2.0
3+
version: 10.2.1
44
repository: https://github.com/flutter-stripe/flutter_stripe
55
homepage: https://pub.dev/packages/flutter_stripe
66

0 commit comments

Comments
 (0)