la-haus / flutter-segment

Segment.io library for flutter
MIT License
22 stars 138 forks source link

Update push token after the initial setContext #91

Open lironzemingo opened 11 months ago

lironzemingo commented 11 months ago

Hi, I'm using Firebase messaging to get the device token and send it to Segment, using

await Segment.setContext({
  'device': {
    'token': yourTokenString
  },
});
await Segment.track(eventName: 'Application Opened');

the thing is, that Firebase has an 'onTokenRefresh' event, where the might be updated. in that case - how do I update the token? if I use the code above, and the only way the token is propagated is by calling Segment.track(eventName: 'Application Opened'); then that might mess up my events, won't it?