घड़ी
dart:core घड़ी API के लिए एक फेकेबल वрапर।
- स्टार
- 41
- फ़ोर्क
- 16
- अंतिम पुश (UTC)
- 28 अक्टू॰ 2024
- प्रोजेक्ट स्थिति
- आर्काइव
मूल README
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
[!IMPORTANT]
This repo has moved to https://github.com/dart-lang/tools/tree/main/pkgs/clock
This package provides a Clock class which encapsulates the notion of the
"current time" and provides easy access to points relative to the current time.
Different Clocks can have a different notion of the current time, and the
default top-level clock's notion can be swapped out to reliably test
timing-dependent code.
For example, you can use clock in your libraries like this:
// run_with_timing.dart
import 'package:clock/clock.dart';
/// Runs [callback] and prints how long it took.
T runWithTiming<T>(T Function() callback) {
var stopwatch = clock.stopwatch()..start();
var result = callback();
print('It took ${stopwatch.elapsed}!');
return result;
}
...and then test your code using the fake_async package, which
automatically overrides the current clock:
// run_with_timing_test.dart
import 'run_with_timing.dart';
import 'package:fake_async/fake_async.dart';
import 'package:test/test.dart';
void main() {
test('runWithTiming() prints the elapsed time', () {
FakeAsync().run((async) {
expect(() {
runWithTiming(() {
async.elapse(Duration(seconds: 10));
});
}, prints('It took 0:00:10.000000!'));
});
});
}
उपयोग की गई निर्भरताएँ
निर्भरता सूची 2 आइटम
- dart_flutter_team_lintsडेवलपमेंट
^3.0.0 - testडेवलपमेंट
^1.16.6
अपने प्रोजेक्ट के लिए रिपॉज़िटरी कैसे चुनें?
उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।
- नाम, लेखक या विवरण से खोजें और तकनीकी विषय से परिणाम सीमित करें।
- स्टार, फ़ोर्क और हाल के पुश की तुलना करें। स्टार रुचि दर्शाते हैं, गुणवत्ता की गारंटी नहीं।
- उपयोग से पहले GitHub पर README, लाइसेंस और Issues जाँचें।
स्रोत और रखरखाव
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗