Skip to content

Instantly share code, notes, and snippets.

@dolpheen
dolpheen / decode_flutter_sksl.dart
Created March 27, 2021 04:11
Decode sksl.json files generated by flutter run --profile --cache-sksl
import 'dart:convert';
import 'dart:io';
void main(List<String> args) async {
if (args.isEmpty || args.length > 1) {
print('The program decodes flutter sksl.json cache files\n');
print('Usage: dart main.dart <skslJsonFile>');
exit(1);
}
@dolpheen
dolpheen / main.dart
Created January 10, 2021 19:37
Futter hack sample demo
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
static const String _title = 'Super App';
@override
@dolpheen
dolpheen / fake_view_configuration.dart
Created July 27, 2020 20:19
Replaces system viewconfiguration
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class CustomWidgetsFlutterBinding extends WidgetsFlutterBinding {
@override
ViewConfiguration createViewConfiguration() {
final ratio = 4.0;
return ViewConfiguration(
size: window.physicalSize / ratio,
devicePixelRatio: ratio,
@dolpheen
dolpheen / test_int.asm
Created July 27, 2020 06:20
test_int ASM source
;; B0
;; B1
;; Invocation Count Check
0x11272abf0 498b7c2437 movq rdi,[r12+0x37]
0x11272abf5 ff8783000000 incl [rdi+0x83]
0x11272abfb 81bf8300000028230000 cmpl [rdi+0x83],0x2328
0x11272ac05 7c07 jl 0x000000011272ac0e
0x11272ac07 41ffa618020000 jmp [thr+0x218]
;; Enter frame
;; PrologueOffset = 30
@dolpheen
dolpheen / test_int.dart
Last active July 27, 2020 06:17
Testing stack variables initialization and handling
main()
{
testFunction();
}
testFunction(){
int k;
int i = 4;
int j = 6;
k = i + j;
@dolpheen
dolpheen / main.il
Created January 18, 2020 21:37
Dart Internals - Getters Setters VM Example (compiled to IL flow graph)
*** BEGIN CFG
Unoptimized Compilation
==== file:///Users/vadimlukicev/dev/getters_setters/main.dart_::_main_main
B0[graph]:0
B1[function entry]:2
t0 <- LoadLocal(:arg_desc @0)
t0 <- LoadField(t0 . ArgumentsDescriptor.type_args_len {final})
t1 <- Constant(#0)
Branch if StrictCompare:8(===, t0, t1) goto (4, 5)
B4[target]:12
@dolpheen
dolpheen / main.dill
Created January 18, 2020 21:35
Dart Internals - Getters Setters VM Example (compiled to dill Kernel AST)
main = main::main;
library from "file:///Users/vadimlukicev/dev/getters_setters/main.dart" as main {
class A extends core::Object {
field core::String* prop = null;
synthetic constructor •() → main::A*
: super core::Object::•()
;
}
class B extends core::Object {
@dolpheen
dolpheen / main.dart
Created January 18, 2020 21:33
Dart Internals - Getters Setters VM Example
class A {
String prop;
}
class B {
String _prop;
String get prop => _prop;
set prop(String value)=>_prop = value;
}
@dolpheen
dolpheen / rotated_box.dart
Created April 19, 2019 19:44
Dart Rotated Box
import 'dart:math' as math;
import 'dart:typed_data';
import 'dart:ui' as ui;
void beginFrame(Duration timeStamp) {
// The timeStamp argument to beginFrame indicates the timing information we
// should use to clock our animations. It's important to use timeStamp rather
// than reading the system time because we want all the parts of the system to
// coordinate the timings of their animations. If each component read the
// system clock independently, the animations that we processed later would be