changeAppKey static method

Future<void> changeAppKey(
  1. String newKey
)

Changes the app key after initialization.

Older reports will be discarded when newKey will be applied.

Invoking this method has no effect unless the agent was already initialized by calling one of the start methods.

Method throws Exception if provided an invalid newKey.

try {
  await Instrumentation.changeAppKey("AA-BBB-CCC");
} catch (e) {
  // handle exception
}

Implementation

static Future<void> changeAppKey(String newKey) async {
  try {
    final args = {
      "newKey": newKey,
    };
    await channel.invokeMethod<void>('changeAppKey', args);
  } on PlatformException catch (e) {
    throw Exception(e.details);
  }
}