First create a hello.dart
file with the following content.
void main(List<String> args) {
print('Hello, World!');
}
Next we precompile this file using PRODUCT
AOT compiler (equivalent of running flutter build aot --release
).
class X { | |
final int Function() foo; | |
const X({this.foo = _defaultFoo}); | |
static int _defaultFoo() => 0; | |
} | |
void main() { | |
print(const X().foo()); |
// Based on Martin Kustermann's version and adding support for | |
// finalization of memory mapped views. | |
import 'dart:ffi'; | |
import 'dart:io'; | |
import 'dart:typed_data'; | |
import 'dart:math' as math; | |
import 'package:ffi/ffi.dart'; | |
void main() { | |
final count = 1000000; | |
final names = ['good', 'bad', 'whatever']; | |
final tests = [_test1, _test2, _test3]; | |
final sw = Stopwatch(); | |
var repeat = 10; | |
sw.start(); | |
while (repeat-- > 0) { | |
for (var i = 0; i < tests.length; i++) { | |
final name = names[i]; |
+------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+ | |
| Library | Method | Diff (Bytes) | | |
+------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+ | |
| package:gallery/codeviewer/code_segments.dart | CodeSegments.transformationsDemo |
+------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+ | |
| Library | Method | Diff (Bytes) | | |
+------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+ | |
| package:gallery/codeviewer/code_segments.dart | CodeSegments.transformationsDemo |
diff --git a/lib/recase.dart b/lib/recase.dart | |
index da14cec..42a1251 100644 | |
--- a/lib/recase.dart | |
+++ b/lib/recase.dart | |
@@ -1,44 +1,94 @@ | |
+import 'dart:typed_data'; | |
+ | |
/// An instance of text to be re-cased. | |
class ReCase { | |
- final RegExp _upperAlphaRegex = new RegExp(r'[A-Z]'); |
First create a hello.dart
file with the following content.
void main(List<String> args) {
print('Hello, World!');
}
Next we precompile this file using PRODUCT
AOT compiler (equivalent of running flutter build aot --release
).
// Copyright (c) 2020, the Dart project authors. | |
// | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions are | |
// met: | |
// * Redistributions of source code must retain the above copyright | |
// notice, this list of conditions and the following disclaimer. | |
// * Redistributions in binary form must reproduce the above | |
// copyright notice, this list of conditions and the following | |
// disclaimer in the documentation and/or other materials provided |
void sayHello() => print('Hello, World!'); |
diff --git a/SuperPi_flutter/lib/pi_calculator.dart b/SuperPi_flutter/lib/pi_calculator.dart | |
index 39faf59..b519f6a 100644 | |
--- a/SuperPi_flutter/lib/pi_calculator.dart | |
+++ b/SuperPi_flutter/lib/pi_calculator.dart | |
@@ -30,7 +30,7 @@ class PiCalculator { | |
double yk1 ; | |
for (int i = 0; i < k; i++) { | |
yk1 = (1 - math.pow((1 - yk * yk * yk * yk),(0.25)))/(1 + math.pow((1 - yk * yk * yk * yk),(0.25))); | |
- ak1 = ak * math.pow((1 + yk1), 4) - math.pow(2, 2 * i + 3) * yk1 * (1 + yk1 + yk1 * yk1); | |
+ ak1 = ak * math.pow((1 + yk1), 4.0) - math.pow(2.0, (2 * i + 3) + 0.0) * yk1 * (1 + yk1 + yk1 * yk1); |