{
  "id": "flutter/dart-format-exception",
  "signature": "FormatException: Unexpected character (at character N) while parsing date string",
  "signature_zh": "FormatException：解析日期字符串时出现意外字符（位于字符 N 处）",
  "regex": "FormatException: Unexpected character \\(at character \\d+\\) while parsing date string",
  "domain": "flutter",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "A date string parsed by intl or another package does not match the expected format pattern, often due to locale differences or malformed input.",
  "root_cause_type": "generic",
  "root_cause_zh": "由 intl 或其它包解析的日期字符串与预期的格式模式不匹配，通常是由于区域设置差异或输入格式错误。",
  "versions": [
    {
      "version": "Flutter 3.13.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Dart 3.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "intl 0.18.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Change the date format pattern randomly until it works",
      "why_fails": "Without understanding the input format, random changes are unlikely to match the actual string.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use try-catch to swallow the exception",
      "why_fails": "Silencing the error does not fix the underlying data issue and may lead to silent failures.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Validate and sanitize the date string before parsing. Example: String cleaned = dateString.replaceAll(RegExp(r'[^0-9:/\\- ]'), ''); DateTime parsed = DateFormat('yyyy-MM-dd HH:mm:ss').parse(cleaned);",
      "success_rate": 0.85,
      "how": "Validate and sanitize the date string before parsing. Example: String cleaned = dateString.replaceAll(RegExp(r'[^0-9:/\\- ]'), ''); DateTime parsed = DateFormat('yyyy-MM-dd HH:mm:ss').parse(cleaned);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a flexible parser like DateTime.tryParse() or the intl package's DateFormat with multiple patterns. Example: DateTime? date = DateFormat('yyyy-MM-dd').tryParse(input) ?? DateFormat('MM/dd/yyyy').tryParse(input);",
      "success_rate": 0.9,
      "how": "Use a flexible parser like DateTime.tryParse() or the intl package's DateFormat with multiple patterns. Example: DateTime? date = DateFormat('yyyy-MM-dd').tryParse(input) ?? DateFormat('MM/dd/yyyy').tryParse(input);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Log the exact input string and expected format to debug the mismatch. Add a debug print: print('Parsing date: $input with format $pattern');",
      "success_rate": 0.95,
      "how": "Log the exact input string and expected format to debug the mismatch. Add a debug print: print('Parsing date: $input with format $pattern');",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Validate and sanitize the date string before parsing. Example: String cleaned = dateString.replaceAll(RegExp(r'[^0-9:/\\- ]'), ''); DateTime parsed = DateFormat('yyyy-MM-dd HH:mm:ss').parse(cleaned);",
    "Use a flexible parser like DateTime.tryParse() or the intl package's DateFormat with multiple patterns. Example: DateTime? date = DateFormat('yyyy-MM-dd').tryParse(input) ?? DateFormat('MM/dd/yyyy').tryParse(input);",
    "Log the exact input string and expected format to debug the mismatch. Add a debug print: print('Parsing date: $input with format $pattern');"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pub.dev/packages/intl",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-11-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}