float property

RegExp float
final

Matches floating-point numbers, including scientific notation.

  • Examples (✅ Valid): 1.5, -3.14, 1e10
  • Examples (❌ Invalid): abc, 1.2.3

Use Case: Prices, measurements, or any decimal-based entry.

Implementation

static final RegExp float = RegExp(r'^(?:-?(?:[0-9]+))?(?:\.[0-9]*)?(?:[eE][\+\-]?(?:[0-9]+))?$');