serialize method Null safety

  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() {
  return super.serialize()
      ..addAll(<String, String>{
        'of': jsonEncode(of.serialize()),
        'matching': jsonEncode(matching.serialize()),
        'matchRoot': matchRoot ? 'true' : 'false',
        'firstMatchOnly': firstMatchOnly ? 'true' : 'false',
      });
}