arguments static method

Map<String, dynamic> arguments(
  1. String action,
  2. Map<String, dynamic> raw
)

Implementation

static Map<String, dynamic> arguments(
  String action,
  Map<String, dynamic> raw,
) {
  if (!actions.contains(action) ||
      raw.keys.any((key) => action != 'nfc.read' || key != 'timeoutMs')) {
    throw const FormatException('Unknown NFC action or property.');
  }
  if (action != 'nfc.read') return {};
  final timeout = raw['timeoutMs'] ?? 15000;
  if (timeout is! int || timeout < 1000 || timeout > maxReadMs) {
    throw const FormatException('NFC timeout must be 1000–30000 ms.');
  }
  return {'timeoutMs': timeout};
}