serialize method

  1. @override
Map<String, String> serialize()
override

Serializes common fields to JSON.

Methods that override serialize are expected to call super.serialize and add more fields to the returned Map.

Implementation

@override
Map<String, String> serialize() {
  if (label is RegExp) {
    final RegExp regExp = label as RegExp;
    return super.serialize()..addAll(<String, String>{
      'label': regExp.pattern,
      'isRegExp': 'true',
    });
  } else {
    return super.serialize()..addAll(<String, String>{
      'label': label as String,
    });
  }
}