Skip to content

Instantly share code, notes, and snippets.

View pingbird's full-sized avatar
🌺

ping pingbird

🌺
View GitHub Profile
import 'package:boxy/flex.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
import 'dart:async';
extension<T> on Stream<T> {
Stream<T> regulate(Duration rateLimit) {
final controller = StreamController<T>();
Timer? timer;
DateTime? lastTime;
T? lastMessage;
listen(
(message) {
void _paintArrow(
Canvas canvas, {
required Color color,
required Offset offset,
required double angle,
double length = 12.0,
}) {
final height = length * (sqrt(3) / 2);
final top = Offset(0, -height / 2);
final left = Offset(-length / 2, height / 2);
import 'dart:convert';
import 'dart:math';
String charToHex(int c) => c.toRadixString(16).padLeft(2, '0');
String charListToHex(List<int> s) => s.map(charToHex).join(' ');
String shortToHex(int c) => c.toRadixString(16).padLeft(4, '0');
String shortListToHex(List<int> s) => s.map(shortToHex).join(' ');
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
import 'dart:math';
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
import 'package:async/async.dart';
import 'package:chopper/chopper.dart' as chopper;
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:http/http.dart';
abstract class RequestCopier {
const RequestCopier._();
factory RequestCopier({
required BaseRequest original,
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
String format(String formatString, Map<String, dynamic> vars) {
return formatString.replaceAllMapped(
RegExp(r'\$(\w+)'),
(name) => '${vars[name.group(1)]}',
);
}
void main() {
print(format(r'There are $count players', {'count': 123}));
print(format(r'$x + $y = $z', {'x': 9, 'y': 10, 'z': 21}));