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:benchmark_harness/benchmark_harness.dart'; | |
final list = List.generate(100000, (index) => index); | |
class CollectionForBenchmark extends BenchmarkBase { | |
const CollectionForBenchmark() : super('CollectionFor'); | |
static void main() { | |
CollectionForBenchmark().report(); | |
} |
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
String prettyHex(List<int> bytes, int length) { | |
final buffer = StringBuffer(); | |
for (var i = 0; i < bytes.length; i += length) { | |
final list = bytes.sublist(i, min(i + length, bytes.length)); | |
final l1 = list.map((e) => e.toRadixString(16).padLeft(2, '0')).toList(); | |
final l2 = list.map((e) { | |
if (e > 0 && e < 128) { | |
return ascii.decode([e]); | |
} | |
return '.'; |
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:html'; | |
import 'package:camera/camera.dart'; | |
import 'package:flutter/material.dart'; | |
Future<void> main() async { | |
runApp(CameraApp()); | |
} | |
class CameraApp extends StatefulWidget { |
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:html'; | |
import 'dart:typed_data'; | |
import 'dart:ui' as ui; | |
import 'package:flutter/material.dart'; | |
void main() { | |
ui.platformViewRegistry.registerViewFactory( | |
'video-view', |
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
message("Found Arduino SDK: ${ARDUINO_SDK_PATH}") | |
## Uncomment if Arduino SDK Path is wrong | |
# set(ARDUINO_SDK_PATH <custom path>) | |
### Edit here | |
set(CLI_PATH <path to arduino-cli.exe) | |
set(FQBN <your fully qualified board name>) | |
set(PORT <your port> |
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:ffi'; | |
import 'dart:io'; | |
import 'package:ffi/ffi.dart'; | |
import 'package:win32/win32.dart'; | |
const healthOffset = 0x12FC58; |
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
class Singleton { | |
static final _instance = Singleton._internal(); | |
factory Singleton() => _instance; | |
Singleton._internal(); | |
} |
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
try { | |
await someFuture(); | |
} catch (e) { | |
print("called when there is an error catches error: $e"); | |
try { | |
print("called with value = null"); | |
} finally { | |
print("called when future completes"); | |
} | |
} |
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
try { | |
await someFuture(); | |
} catch (e) { | |
print("called when there is an error catches error: $e"); | |
try { | |
print("called with value = null"); | |
} finally { | |
print("called when future completes"); | |
} | |
} |
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
.parseint : Parse a String to an Integer | |
ANY → int.parse($expr$) | |
.tryparseint : Try to parse a String to an Integer | |
ANY → int.tryParse($expr$) |
NewerOlder