Update README example for modern Dart conventions (#64)
diff --git a/README.md b/README.md
index 04e0359..a5f082d 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@
2\. Install pub packages
```
-pub install
+dart pub install
```
3\. Add the following import:
@@ -56,10 +56,10 @@
## Example
-Create a dart file in the [`benchmark/`](https://www.dartlang.org/tools/pub/package-layout#tests-and-benchmarks)
+Create a dart file in the [`benchmark/`](https://dart.dev/tools/pub/package-layout#tests-and-benchmarks)
folder of your package.
-```
+```dart
// Import BenchmarkBase class.
import 'package:benchmark_harness/benchmark_harness.dart';
@@ -68,24 +68,23 @@
const TemplateBenchmark() : super('Template');
static void main() {
- TemplateBenchmark().report();
+ const TemplateBenchmark().report();
}
// The benchmark code.
@override
- void run() {
- }
+ void run() {}
// Not measured setup code executed prior to the benchmark runs.
@override
- void setup() { }
+ void setup() {}
// Not measured teardown code executed after the benchmark runs.
@override
- void teardown() { }
+ void teardown() {}
}
-main() {
+void main() {
// Run TemplateBenchmark
TemplateBenchmark.main();
}