mixpanel-flutter icon indicating copy to clipboard operation
mixpanel-flutter copied to clipboard

Implement setLoggingEnabled for Flutter Web

Open jaredmixpanel opened this issue 6 months ago • 0 comments

setLoggingEnabled is currently only implemented for native iOS and Android channels, because those native platforms already have an existing method that directly maps to setLoggingEnabled. Web does not, but similar functionality can be achieved via the set_config method in the JavaScript library where we can set the debug option to true or false. For example:

// Enable debug logging at runtime  
mixpanel.set_config({debug: true});  
  
// Disable debug logging at runtime    
mixpanel.set_config({debug: false});

A similar pattern already exists for setServerURL on web which actually calls set_config in the JS library:

  void handleSetServerURL(MethodCall call) {
    Map<Object?, Object?> args = call.arguments as Map<Object?, Object?>;
    String serverURL = args['serverURL'] as String;
    set_config(safeJsify({'api_host': serverURL}));
  }

This issue is to extend setLoggingEnabled support to the Flutter Web channel following that pattern.

jaredmixpanel avatar Jul 07 '25 23:07 jaredmixpanel