Properties

You can create properties objects to add additional information to events. You can then use this extra information to further break down the event.

Create Properties

Smartlook APIs provide user and event Properties singletons. To create other Properties for track events, use the default constructor:

final Properties properties = Properties();

Put property

You can add properties using the putString() method. Every property is defined by a name and value:

properties.putString('sample_key', value: 'sample_value');

🚧

Name restrictions

  • Cannot be empty or null.
  • Maximum length is 200 characters.
  • Can only contain alphanumeric characters, underscore (_), comma (,), period (.), and hyphen (-).
  • Must start with an alphabetic character.

🚧

Value restrictions

  • The maximum length is 5 kilobytes.

Get property

You can read any property using the getString() method. If a property with the name exists, then the value is returned. Otherwise, null is returned:

final String? sampleValue = properties.getString('sample_key');

Remove property

You can remove any property using the remove() method, or by setting it to null:

properties.remove('sample_key');
properties.putString('sample_key', null);

Clear properties

You can clear all properties using clear():

properties.clear();