unify_fcm 1.0.0 copy "unify_fcm: ^1.0.0" to clipboard
unify_fcm: ^1.0.0 copied to clipboard

A Light-weight Flutter package to send remote push notifications using Firebase Cloud Messaging (FCM) v1 API and generate access token from service account.

Unify library Crafted by the UNICODE Team.

A Light-weight Flutter package to send remote push notifications using Firebase Cloud Messaging (FCM) v1 API and generate access token from service account.πŸ‡ΈπŸ‡¦πŸ’™πŸ‡§πŸ‡©β€οΈπŸ‡ͺπŸ‡¬

Features support #

  • Access Token: You can create bearer access token using your project service account json file.
  • Text Notification: Sending reguler text notification with title, and body πŸ“².
  • Image Notification: You can send image too, if your app support image notification πŸ˜‰
  • Topic Notification: Send notification to all subscribers of topic πŸ“¬.
unify_fcm by Saif

Getting started #

Please have a look at our /example project for a better understanding of implementations.

Initialize it in the main.dart file to send the notification.

 UnifyServices.initUnify(
    config: UnifyConfig(
      fcmAccessToken: "your_fcm_access_token_here",
      projectName: "your_firebase_project_name_here",
    ),
  );

Generate the bearer access token.

  String? token = await UnifyServices.genTokenFromServiceAcc(
                  serviceAccount: {
                    "type": "service_account",
                    "project_id": "",
                    "private_key_id": "",
                    "private_key": "",
                    "client_email": "",
                    "client_id": "",
                    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
                    "token_uri": "https://oauth2.googleapis.com/token",
                    "auth_provider_x509_cert_url":
                        "https://www.googleapis.com/oauth2/v1/certs",
                    "client_x509_cert_url": "",
                    "universe_domain": "googleapis.com"
                  },
                );

Send notification to user using fcm token.

 String? id = await UnifyServices.sendNotification(
                      notification: UnifyNoficationModel(
                    token: "your_user_fcm_token_here",
                    notifyId: "1",
                    title: "Hi Unify Fan :)",
                    body: "Let's go to the Unify world ^_^",
                    imageUrl:
                        "https://images.pexels.com/photos/9551192/pexels-photo-9551192.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
                  ));

Send notification to topics channel.

 String? id = await UnifyServices.sendNotification(
                      notification: UnifyNoficationModel(
                    topic: "your_topic_name_here",
                    notifyId: "1",
                    title: "Hi Unify Fans :)",
                    body: "Let's go to the Unify world ^_^",
                    imageUrl:
                        "https://images.pexels.com/photos/9551192/pexels-photo-9551192.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
                  ));

If you enjoyed it, then give it a star ⭐️ and like πŸ‘πŸ» and for more arts & crafts 🎨 from our team kindly visit here Team UNICODE. Until next time, keep coding and stay awesome πŸ˜‰

3
likes
160
points
25
downloads

Publisher

verified publisherunicodesolutions.co

Weekly Downloads

A Light-weight Flutter package to send remote push notifications using Firebase Cloud Messaging (FCM) v1 API and generate access token from service account.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, googleapis_auth, http

More

Packages that depend on unify_fcm