AndroidHapticCapabilities.fromMap constructor

AndroidHapticCapabilities.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory AndroidHapticCapabilities.fromMap(Map<String, dynamic> map) {
  return AndroidHapticCapabilities(
    hapticSupportLevel: map['hapticSupportLevel'] ?? 0,
    areOnOffHapticsSupported: map['areOnOffHapticsSupported'] ?? false,
    areAmplitudeControlHapticsSupported:
        map['areAmplitudeControlHapticsSupported'] ?? false,
    areAudioCoupledHapticsSupported:
        map['areAudioCoupledHapticsSupported'] ?? false,
    areEnvelopeHapticsSupported: map['areEnvelopeHapticsSupported'] ?? false,
    resonanceFrequency: map['resonanceFrequency'],
    qFactor: map['qFactor'],
    minFrequency: map['minFrequency'],
    maxFrequency: map['maxFrequency'],
    maxAcceleration: map['maxAcceleration'],
    frequencyResponse: map['frequencyResponse']?.map<int, double>(
      (k, v) => MapEntry(
        (k is int) ? k : int.tryParse(k.toString()) ?? 0,
        (v as num).toDouble(),
      ),
    ),
    envelopeControlPointMinDurationMillis:
        map['envelopeControlPointMinDurationMillis'],
    envelopeControlPointMaxDurationMillis:
        map['envelopeControlPointMaxDurationMillis'],
    envelopeMaxDurationMillis: map['envelopeMaxDurationMillis'],
    envelopeMaxControlPointCount: map['envelopeMaxControlPointCount'],
  );
}