Skip to content

Instantly share code, notes, and snippets.

View knaeckeKami's full-sized avatar

Martin Kamleithner knaeckeKami

View GitHub Profile
@knaeckeKami
knaeckeKami / main.dart
Last active August 15, 2023 19:41
astonishing-spray-1411
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
void main() {
runApp(const MyApp());
}
@knaeckeKami
knaeckeKami / main.dart
Created August 14, 2023 10:40
silent-ritual-3131
import 'package:flutter/material.dart';
import 'dart:math' as math;
import 'dart:ui' as ui;
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
@knaeckeKami
knaeckeKami / main.dart
Created June 27, 2023 14:42
astonishing-spray-1411
extension Let<T extends Object> on T? {
S? let<S>(S Function(T) f) {
final self = this;
if(self == null){
return null;
}
return f(self);
@knaeckeKami
knaeckeKami / script.sh
Created June 26, 2023 19:39
check_if_commits.sh
BRANCH=refs/remotes/origin/main
LAST_REV=$(git rev-parse --verify $BRANCH)
LAST_TAG=$(git describe --tag --abbrev=0 $LAST_REV)
COMMIT_COUNT=$(git rev-list --count $BRANCH $LAST_TAG..)
if [ $COMMIT_COUNT = 0 ]; then
echo "Nothing to build! No commits since $LAST_TAG on $BRANCH."
exit 0;
@knaeckeKami
knaeckeKami / main.dart
Created April 4, 2023 14:32
silent-ritual-3131
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
void main() {
asyncInit();
}
Future<void> asyncInit() async {
await Future.wait([
for (var i = 0; i < 10; i++) ...[
asyncParent(),
],
]);
Info: Compiling with sound null safety.
../../runtime/vm/compiler/backend/flow_graph_compiler.cc: 737: error: expected: !is_optimizing() || !instr->HasUnmatchedInputRepresentations()
version=3.0.0-75.0.dev (dev) (Thu Dec 29 16:50:26 2022 -0800) on "macos_arm64"
pid=72359, thread=-1, isolate_group=isolate(0x13902c800), isolate=(nil)(0x0)
os=macos, arch=arm64, comp=no, sim=no
isolate_instructions=0, vm_instructions=0
pc 0x0000000104819440 fp 0x000000016b738e20 Cr_z_armv8_crc32_little+0x113f54
pc 0x00000001046f3168 fp 0x000000016b738e40 std::__2::align(unsigned long, unsigned long, void*&, unsigned long&)+0x7344
pc 0x000000010495dccc fp 0x000000016b739000 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0x6eab0
pc 0x000000010495d378 fp 0x000000016b739030 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0x6e15c

Migrating Ferry to Isolates

Problem

Parsing large graphql responses and normalizing them is a potentially expensive operation that can lead to skipped frames.

Users complained about this in issues like this: gql-dart/ferry#394 (comment)

Goal

@knaeckeKami
knaeckeKami / main.dart
Created December 7, 2022 15:29
astonishing-spray-1411
import 'package:flutter/material.dart';
import 'dart:math';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(SizedBox(height: 200, child: HalfCircleWidget(values: [1,2,3])));
}
@knaeckeKami
knaeckeKami / main.dart
Created December 7, 2022 15:20
astonishing-spray-1411
import 'package:flutter/material.dart';
import 'dart:math';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MaterialApp(home: Scaffold(body :CircleClipperSlider(child: Container(
height: 200,
width: 200,
color: Colors.orange)))));