Flutter web with firebase notifications - subscribeToTopic

1,822

The JavaScript SDK for Firebase Cloud Messaging does not support subscribing to topics, which unfortunately that Flutter for web also doesn't/won't have it.

This means that a web app cannot subscribe itself to topics, like Android and iOS apps can. Instead, for web apps, you will have to use a server-side SDK to subscribe to a topic.

So you'll need to:

  1. Create a custom server-side API that uses one of the Admin SDKs, or the REST API, to subscribe a specific FCM device token to a specific topic. This code needs to run on a trusted environment, such as your development machine, a server that you control, or Cloud Functions.
  2. You then call this custom API from within your Flutter application.

Also see:

Share:
1,822
Daniel Cardoso Ishara
Author by

Daniel Cardoso Ishara

Updated on December 25, 2022

Comments