jpush_helper.dart 413 B

12345678910111213141516171819
  1. import 'package:jpush_flutter/jpush_flutter.dart';
  2. import 'package:jpush_flutter/jpush_interface.dart';
  3. class JpushHelper {
  4. JpushHelper._();
  5. static JPushFlutterInterface? jpush;
  6. static void init() {
  7. jpush = JPush.newJPush();
  8. }
  9. static Future<String> getRegistrationId() {
  10. if (jpush == null) {
  11. throw Exception('JPush not initialized');
  12. }
  13. return jpush!.getRegistrationID();
  14. }
  15. }