toMap method

Map<String, dynamic> toMap()

Converts this DecibelData instance to a map.

Returns a map containing:

  • decibel: double
  • timestamp: double

Example:

final data = DecibelData(
  decibel: -45.0,
  timestamp: 1234567890.0,
);
final map = data.toMap();
// map = {'decibel': -45.0, 'timestamp': 1234567890.0}

Implementation

Map<String, dynamic> toMap() {
  return {
    'decibel': decibel,
    'timestamp': timestamp,
  };
}