modifyMetaData method

void modifyMetaData(
  1. CustomizableWiredashMetaData mutation(
    1. CustomizableWiredashMetaData metaData
    )
)

Modify the metadata that will be collected with Wiredash

The metadata include user information (userId and userEmail) and any custom data (Map<String, Object?>) you want to have attached to feedback.

Setting the userEmail prefills the email field.

The build information is prefilled with

  • build data from EnvBuildInfo injected during compile time
  • app information like the app version
  • session information like the appLocale (from context)

Usage:

Wiredash.of(context).modifyMetaData(
  (metaData) => metaData
    ..userEmail = 'dash@wiredash.com'
    ..buildCommit = '43f23dd'
    ..custom['screen'] = 'HomePage'
    ..custom['isPremium'] = false,
);

Reset

To reset all metadata (i.e. when the user signs out) use:

await Wiredash.of(context).resetMetaData();

Scope

Please do not keep a reference to the incoming metaData parameter. The reference might not be outdated and not be used. The metaData object is only guaranteed to be up-to-date within the modifyMetaData method.

Implementation

void modifyMetaData(
  CustomizableWiredashMetaData Function(CustomizableWiredashMetaData metaData)
      mutation,
) {
  _captureSessionMetaData();
  final before = _model.customizableMetaData.copyWith();
  final after = mutation(before);
  _model.customizableMetaData = after;
}