toMap method
Implementation
Map<String, dynamic> toMap() {
var map = <String, dynamic>{"type": type!.toValue(), "selector": selector};
map.keys
.where((key) =>
map[key] == null ||
(map[key] is List && (map[key] as List).isEmpty)) // filter keys
.toList() // create a copy to avoid concurrent modifications
.forEach(map.remove);
return map;
}