Technology | Time taken for tests (sec) | Complete requests | Failed requests | Requests per second (mean) | Time per request (ms) | Time per request (concurrent ms) | Transfer rate (Kbytes/sec) |
---|---|---|---|---|---|---|---|
CivetWeb | 40.100 | 100,000 | 129 | 2493.77 | 400.999 | 0.401 | 136.21 |
Dart + Shelf | 12.758 | 100,000 | 0 | 7837.96 | 127.584 | 0.128 | 2005.42 |
Node.js | 10.457 | 100,000 | 0 | 9562.88 | 104.571 | 0.105 | 1055.28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:isolate'; | |
void main() async { | |
final toMainIsolate = ReceivePort(); | |
final stream = toMainIsolate; | |
void fn(ITargetAction action) => action.handleAction(); | |
final worker = Worker<ITargetAction>( | |
port: toMainIsolate.sendPort, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
import 'package:crypto/crypto.dart'; | |
import 'package:meta/meta.dart'; | |
/// {@template jwt} | |
/// A JWT token consists of three parts: the header, | |
/// the payload, and the signature or encryption data. | |
/// The first two elements are JSON objects of a specific structure. | |
/// The third element is calculated based on the first two |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
void main() { | |
final jsonRaw = '{"items": [1, 2, 3]}'; | |
final json = jsonDecode(jsonRaw) as Map<String, Object?>; // good | |
try { | |
//final items = (json['items'] as List<Object?>).cast<int>().toList(); // good | |
final items = json['items'] as List<int>; // bad | |
print(items); | |
} on Object catch (err) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/widgets.dart'; | |
import 'sizer.dart'; | |
class AdaptiveWidget extends StatefulWidget { | |
const AdaptiveWidget({ | |
required this.compactChild, | |
required this.extendedChild, | |
this.alignment = Alignment.center, | |
super.key, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Dependencies | |
abstract interface class Dependencies { | |
/// The state from the closest instance of this class. | |
factory Dependencies.of(BuildContext context) => InheritedDependencies.of(context); | |
/// App metadata | |
abstract final AppMetadata appMetadata; | |
/// Database | |
abstract final Database database; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:ui' as ui; | |
import 'package:flutter/widgets.dart'; | |
import 'package:meta/meta.dart'; | |
/// {@macro screen_util} | |
extension ScreenUtilExtension on BuildContext { | |
/// Get current screen logical size representation | |
/// | |
/// phone | <= 600 dp | 4 column |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:convert'; | |
import 'dart:io' as io; | |
import 'package:args/args.dart'; | |
/// Entry point for the application. | |
void main(List<String> arguments) => runZonedGuarded<void>(() async { | |
final argResult = (ArgParser() | |
..addFlag('help', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() => runZonedGuarded<void>( | |
() => runApp(const App()), | |
(error, stackTrace) => log('Top level exception $error'), | |
); | |
class App extends StatelessWidget { | |
const App({super.key}); | |
@override | |
Widget build(BuildContext context) => MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Dependencies | |
abstract interface class Dependencies { | |
/// The state from the closest instance of this class. | |
factory Dependencies.of(BuildContext context) => InheritedDependencies.of(context); | |
/// Database | |
abstract final Database database; | |
} | |
final class $MutableDependencies implements Dependencies { |