How to get OneSignal ID and save it to FFAppState in FlutterFlow?

Integrations

Hello, I want to retrieve the OneSignal device ID and save it to FFAppState in my FlutterFlow app.

  1. What is the best way to get the OneSignal ID? Is there a function or action that returns the OneSignal ID?

  2. How can I store the retrieved OneSignal ID in FFAppState?

  3. Should I perform this task in main.dart, or should I do it during the login or create account process?

I would appreciate your help in figuring out the best approach for this.

What have you tried so far?

Retrieving the OneSignal ID in main.dart: This approach attempts to get the device ID when the app starts, but handling asynchronous operations properly is essential.

Retrieving the OneSignal ID during the createAccount or login process: This approach focuses on getting the ID when the user creates an account or logs in.

Did you check FlutterFlow's Documentation for this topic?
No
1