The Event object helps you create custom events and event parameters in different data types. This article explains how you can build events and parameters in various data types.
Set tag event
This method returns a new chainable Insider event object in which you can add parameters.
| Parameter | Data Type |
|---|---|
| eventName | String |
Method Signature
FlutterInsiderEvent tagEvent(String eventName)Method Example
// You can create an event without parameters and call the build method.
FlutterInsider.Instance.tagEvent("eventName").build();
// You can create an event, then add parameters and call the build method.
FlutterInsider.Instance.tagEvent("eventName")
.addParameterWithInt("key", 10)
.build();
// You can create an object and add the parameters later.
FlutterInsiderEvent insiderExampleEvent = FlutterInsider.Instance.tagEvent("eventName");
// Do not forget to call build method after implementing the desired parameters to the related event.
//Otherwise your event will be ignored.
insiderExampleEvent.build();Build event
This method allows you to build your Insider event object.
Method Signature
Future build() asyncMethod Example
insiderExampleEvent.build();Set string parameter
This method allows you to set the string parameter of your Insider event object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | String |
The value can be up to 50,000 characters. For arrays, the limit applies to each string. An event with a longer value isn't recorded.
Method Signature
FlutterInsiderEvent addParameterWithString(String key, String value)Method Example
// You can create an event, then add parameters and call the build method.
FlutterInsider.Instance.tagEvent("eventName")
.addParameterWithString("key", "value")
.build();
// You can create an object and add the parameters later.
FlutterInsiderEvent insiderExampleEvent = FlutterInsider.Instance.tagEvent("eventName");
insiderExampleEvent.addParameterWithString("key", "value");
// Do not forget to call build method after implementing the desired parameters to the related event.
// Otherwise your event will be ignored.
insiderExampleEvent.build();Set integer parameter
This method allows you to set the integer parameter of your Insider event object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Integer |
Method Signature
FlutterInsiderEvent addParameterWithInt(String key, int value)Method Example
// You can create an event, then add parameters and call the build method.
FlutterInsider.Instance.tagEvent("eventName")
.addParameterWithInt("key", 10)
.build();
// You can create an object and add the parameters later.
FlutterInsiderEvent insiderExampleEvent = FlutterInsider.Instance.tagEvent("eventName");
insiderExampleEvent.addParameterWithInt("key", 10);
// Do not forget to call build method after implementing the desired parameters to the related event.
// Otherwise your event will be ignored.
insiderExampleEvent.build();Set double parameter
This method allows you to set the double parameter of your Insider event object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Double |
Method Signature
FlutterInsiderEvent addParameterWithDouble(String key, double value)Method Example
// You can create an event, then add parameters and call the build method.
FlutterInsider.Instance.tagEvent("eventName")
.addParameterWithDouble("key", 10.5)
.build();
// You can create an object and add the parameters later.
FlutterInsiderEvent insiderExampleEvent = FlutterInsider.Instance.tagEvent("eventName");
insiderExampleEvent.addParameterWithDouble("key", 10.5);
// Do not forget to call build method after implementing the desired parameters to the related event.
// Otherwise your event will be ignored.
insiderExampleEvent.build();Set date parameter
This method allows you to set the date parameter of your Insider event object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Date |
Method Signature
FlutterInsiderEvent addParameterWithDate(String key, DateTime value)Method Example
// You can create an event, then add parameters and call the build method.
FlutterInsider.Instance.tagEvent("eventName")
.addParameterWithDate("key", new DateTime.now())
.build();
// You can create an object and add the parameters later.
FlutterInsiderEvent insiderExampleEvent = FlutterInsider.Instance.tagEvent("eventName");
insiderExampleEvent.addParameterWithDate("key", new DateTime.now());
// Do not forget to call build method after implementing the desired parameters to the related event.
// Otherwise your event will be ignored.
insiderExampleEvent.build();Set array of string parameter
This method allows you to set the array of string parameter of your Insider event object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Array (of string) |
The value can be up to 50,000 characters. For arrays, the limit applies to each string. An event with a longer value isn't recorded.
Method Signature
FlutterInsiderEvent addParameterWithStringArray(String key, List<String> values)Method Example
List<String> stringArray = new List(3);
arr[0] = "value1";
arr[1] = "value2";
arr[2] = "value3";
FlutterInsider.Instance.tagEvent("eventName")
.addParameterWithStringArray("key", stringArray)
.build();Set array of number parameter
This method allows you to set the array of string parameter of your Insider event object.
| Parameter | Data Type |
|---|---|
| key | Number |
| value | Array (of number) |
Method Signature
FlutterInsiderEvent addParameterWithNumericArray(String key, List<num> values)Method Example
List<num> numberArray = new List(3);
arr[0] = 5;
arr[1] = 3.14;
arr[2] = 100;
FlutterInsider.Instance.tagEvent("eventName")
.addParameterWithNumericArray("key", numberArray)
.build();Set boolean parameter
This method allows you to set the boolean parameter of your Insider event object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Boolean |
Method Signature
FlutterInsiderEvent addParameterWithBoolean(String key, bool value)Method Example
// You can create an event, then add parameters and call the build method.
FlutterInsider.Instance.tagEvent("eventName")
.addParameterWithBoolean("key", true)
.build();
// You can create an object and add the parameters later.
FlutterInsiderEvent insiderExampleEvent = FlutterInsider.Instance.tagEvent("eventName");
insiderExampleEvent.addParameterWithBoolean("key", true);
// Do not forget to call build method after implementing the desired parameters to the related event.
// Otherwise your event will be ignored.
insiderExampleEvent.build();Add an Array of Objects event parameter
Use this method to attach a list of objects to an event as a parameter. Define the event parameter in the panel first; see Create an Array of Objects Attribute.
Rules for object values:
- Object keys must match ^[a-z][0-9a-z_]*$. Invalid keys are dropped and named in a console warning; the rest of the call is still sent.
- An attribute or parameter key that is empty, whitespace-only, or does not match the same pattern is refused with a console warning.
- Values can be String, int, double, bool, DateTime, a List or Set of strings or numbers, or a nested Map<String, Object>.
- A string longer than 500 characters, a null value, and a NaN or infinite number are dropped and named in a single console warning per call.
- A nested map can hold only plain values; a map inside a nested map is dropped with its key and named in the console warning. For example, {'a': {'b': 1}} is sent as is, while in {'a': {'b': {'c': 1}, 'd': 2}} 'b' is dropped and 'a' is sent with 'd' only.
- An object that keeps no key is dropped.
Call addParameterWithObjectArray on an event to attach a list of objects as a parameter.
| Parameter | Data Type | Description |
|---|---|---|
| key | String | Key of the Array of Objects event parameter defined in the panel. |
| objects | List<Map<String, Object>> | The objects to send. |
Method Signature
FlutterInsiderEvent addParameterWithObjectArray(
String key, List<Map<String, Object>> objects)Method Example
import 'package:flutter_insider/flutter_insider.dart';
FlutterInsider.Instance.tagEvent('purchase_completed')
.addParameterWithObjectArray('c_order_lines', [
{'sku': 'SKU-1', 'qty': 2, 'unit_price': 19.9},
{'sku': 'SKU-2', 'qty': 1, 'unit_price': 5.5},
])
.build();Array of Objects event parameters are insert-only: once sent, they cannot be updated. An empty list, or a list in which no object keeps a key, adds no parameter and a console warning says so; the event is still sent with its other parameters.