Skip to content

Commit 23fba37

Browse files
gnpriceshivanshsharma13
authored andcommitted
notif: Add vm:entry-point pragma on class, too
Fixes zulip#1119. With Flutter from main, in release mode, the app would no longer show notifications on Android when it was in the background. This error message appears in logcat: ``` DartVM E ERROR: To access 'package:zulip/notifications/receive.dart::NotificationService' from native code, it must be annotated. ERROR: See https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/entry_point_pragma.md ``` It looks like the relevant upstream commit is probably this one: dart-lang/sdk@9b06e26 AFAICT those docs don't actually say that we should need to annotate the class. We already do annotate the static *method* on this class which we ask native code to call, namely `_onBackgroundMessage`. At least the error message is nice and clear, though.
1 parent 70b2813 commit 23fba37

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/notifications/receive.dart

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import '../log.dart';
99
import '../model/binding.dart';
1010
import 'display.dart';
1111

12+
@pragma('vm:entry-point')
1213
class NotificationService {
1314
static NotificationService get instance => (_instance ??= NotificationService._());
1415
static NotificationService? _instance;

0 commit comments

Comments
 (0)