[Flutter] Change sentry dsn at runtime

Hi, i am working on an flutter app that is configured differently for each customer, i need to change the sentry dsn at runtime.
Steps required:

  1. app starts
  2. app inits sentry with a master dsn common for all customers (call SentryFlutter.init())
  3. app loads some config file containing the customer allocated dsn (https://958eb73f9b4c43a88ffa3549…)
  4. configure sentry sdk to use this customer dsn.

So far i have tried Sentry.bindClient() but after the bind the captured messages lack lots of information such as tags, app version, device information and more.

Thanks.

Hi, you can’t change the DSN at runtime, the options are immutable.

you’ve to call Sentry.close(); and init the SDK again with the new configuration.

1 Like