toMap is the method to convert the class to a map.
Map<String, dynamic> toMap() { return { 'name': name, 'frequency': frequency, }; }