FLUTTER ECOSYSTEM

adaptive_number

Library providing an adaptive number implementation. On JS runtimes, a 64-bit signed fixed-width integer will be used and for all other platforms the default Dart int data type.

Latest version
1.0.0
30-day downloads
551K
Likes
2
Pub points
150

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

The adaptive_number package provides a number type that adapts to the runtime environment. On JavaScript platforms, it uses a 64-bit signed fixed-width integer for consistent precision, while on all other platforms it defaults to Dart's native int. This ensures reliable behavior across web and native environments, particularly when handling large integers or requiring cross-platform consistency in numerical operations.

Use cases
  • Cross-platform integer handling
  • Web-based applications with large numbers
  • Consistent arithmetic across platforms
  • Data serialization involving integers
  • Numerical computations in Flutter web apps
Key features
  • Adaptive integer size based on platform
  • 64-bit fixed-width integers on JS
  • Native int fallback on non-JS platforms
  • Consistent behavior across runtimes
  • Simple integration with existing code
Suitable for
  • Developers targeting web and native platforms
  • Apps requiring precise integer arithmetic
  • Projects needing portability of numeric logic
  • Teams avoiding JS-specific number limitations
  • Flutter apps with shared business logic
Considerations
  • Limited to integer values only
  • No support for floating-point numbers
  • Performance overhead on non-JS platforms
  • May not be needed for simple use cases
  • Requires careful testing on JS targets
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add adaptive_number

Categories

Dependencies

Dependency list 1 items

Source repository

Related projects