Skip to content

Instantly share code, notes, and snippets.

@jezell
jezell / main.dart
Created October 24, 2024 01:38
3.27.1 compiler fail
import 'package:flutter/material.dart';
import 'package:web/web.dart' as web;
import 'package:dart_webrtc/dart_webrtc.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
import "package:flutter/material.dart";
class FutureRegistry {
final List<Future> _futures = [];
void register(Future f) {
_futures.add(f);
f.whenComplete(() {
_futures.remove(f);
});
@jezell
jezell / main.dart
Last active September 27, 2024 17:25
Flutter web compositor memory leak
// Copyright 2019 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'dart:js_interop';
void main() => runApp(const MyApp());
@JS('window.flutterCanvasKit.HEAP8.byteLength')
@jezell
jezell / auto_overlay_portal.dart
Created September 4, 2024 02:13
Auto Overlay Portal
import "package:flutter/material.dart";
class AutoOverlayPortal extends StatefulWidget {
const AutoOverlayPortal(
{super.key, required this.overlayChildBuilder, this.child});
final Widget Function(BuildContext) overlayChildBuilder;
final Widget? child;
@override
@jezell
jezell / main.dart
Created September 2, 2024 20:27
Context Menu Hell
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:async';
void main() => runApp(const EditableTextToolbarBuilderExampleApp());
class EditableTextToolbarBuilderExampleApp extends StatefulWidget {
const EditableTextToolbarBuilderExampleApp({super.key});
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:uri/uri.dart';
class PathRouteMatch {
PathRouteMatch(
{required this.parameters,
import "package:flutter/material.dart";
abstract class Controller extends ChangeNotifier {
static T ofType<T extends Controller>(BuildContext context) {
return context
.dependOnInheritedWidgetOfExactType<_ControllerModel<T>>()!
.controller;
}
static T? maybeOfType<T extends Controller>(BuildContext context) {
void main() {
print(fullName(null, null));
print(fullName('John', null));
print(fullName(null, 'Doe'));
print(fullName("John", 'Doe'));
}
@jezell
jezell / main.dart
Last active June 12, 2024 15:58
draggable
// Copyright 2019 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
import UIKit
import Flutter
import app_links
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?