Skip to content

Instantly share code, notes, and snippets.

View selectable_sqlite_async.dart
import 'package:sqlite3/sqlite3.dart';
import 'package:sqlite_async/sqlite_async.dart';
typedef RowParser<T> = T Function(Row row);
extension SqliteDatabaseUtils on SqliteDatabase {
Selectable<T> select<T>(
String sql, {
List<Object?> parameters = const [],
Set<String> tables = const {},
View signals_fullname_example.dart
import 'package:flutter/material.dart';
import 'package:signals/signals_flutter.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) => const MaterialApp(
View signals.dart
import 'package:flutter/material.dart';
final brightness = signal(Brightness.light);
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
View preact_signals.dart
// ignore_for_file: public_member_api_docs, constant_identifier_names
const _maxCallDepth = 100;
void cycleDetected() {
throw Exception('Cycle detected');
}
void mutationDetected() {
throw Exception('Computed cannot have side-effects');
}
View flutter_native_http.dart
import 'package:cronet_http/cronet_http.dart';
import 'package:cupertino_http/cupertino_http.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:fetch_client/fetch_client.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:platform_info/platform_info.dart';
import 'package:flutter/foundation.dart';
void main() async {
@rodydavis
rodydavis / flutter_stream_widget.dart
Created November 2, 2023 23:16
Render a widget as a stream instead of a single funciton
View flutter_stream_widget.dart
import 'dart:async';
import 'package:flutter/widgets.dart';
abstract class StreamWidget extends StatefulWidget {
const StreamWidget({Key? key}) : super(key: key);
Stream<Widget> build(BuildContext context);
void initState() {}
@rodydavis
rodydavis / input_output_preview.dart
Created November 1, 2023 22:01
Flutter input, output, preview
View input_output_preview.dart
import 'package:flutter/material.dart';
import 'two_pane.dart';
class InputOutputPreview extends StatefulWidget {
const InputOutputPreview({
super.key,
required this.title,
required this.input,
required this.output,
@rodydavis
rodydavis / figma-codegen-lit.ts
Created June 23, 2023 07:36
Generate Lit Web Component with Figma API Dev Mode
View figma-codegen-lit.ts
figma.codegen.on('generate', async (event) => {
const name = event.node.name;
const names = getUniqueNodeNames(event.node, {});
const css = await createCss(event.node, names);
const tokens = getTokens(event.node, []);
const html = await createHtml(event.node, names);
const code = template(name, css, html, tokens);
return [
{
language: "TYPESCRIPT",
@rodydavis
rodydavis / ltxml.js
Created April 5, 2023 17:26 — forked from xndcn/ltxml.js
View ltxml.js
/***************************************************************************
Copyright (c) Microsoft Corporation 2013.
This code is licensed using the Microsoft Public License (Ms-PL). You can find the text of the license here:
http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx
Published at http://OpenXmlDeveloper.org
Resource Center and Documentation: http://openxmldeveloper.org/wiki/w/wiki/open-xml-sdk-for-javascript.aspx
View flutter_adaptive_markdown_source.dart
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(