adaptive_number
एक एडाप्टिव नंबर के कार्यान्वयन प्रदान करने वाली लाइब्रेरी। JS रनटाइम में, 64-बिट साइन्ड फिक्स्ड-विड्थ पूर्णांक का उपयोग किया जाएगा और सभी अन्य प्लेटफॉर्म के लिए डार्ट के डिफ़ॉल्ट int डेटा प्रकार का उपयोग किया जाएगा।
lemoony/adaptive_number_dart open-source repository details.
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
A library providing a Number implementation that is dependent on the platform it is compiled for.
For JS runtimes, the implementation uses a 64-bit signed fixed-width integer, for all other platforms
the default Dart int data type.
The Number substitute is useful in situations where a value may overflow on JS runtimes since the available value range
is not the same compared to mobile or desktop platforms:
https://api.dart.dev/stable/2.8.4/dart-core/int-class.html
The overflow on JS environments can be circumvented by using a BigInt or the fixed-with implementation of this library: https://pub.dev/packages/fixnum
The disadvantage of just replacing all usages of int with BigInt or fixnum/Int64 is that the performance on
mobile platforms may suffer significantly.
The adpative_number library takes a conditional import approach to ease this problem:
Number wraps a fixnum/Int64Number wraps a default Dart int type.Some historical background of this library can also be seen in: https://github.com/MixinNetwork/libsignal_protocol_dart/pull/43
A Number instance is created by wrapping it around a default int value:
import 'package:adaptive_number/adaptive_number.dart';
void main() {
final number1 = Number(93432);
final number2 = Number(42435);
assert((number1 + number2) == Number(51777));
}
All other operations on Number behave the same way as with int.
Please file feature requests and bugs at the issue tracker.
उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗