Skip to content

Instantly share code, notes, and snippets.

View ditman's full-sized avatar
💙
Flutterin'

David Iglesias ditman

💙
Flutterin'
View GitHub Profile
@ditman
ditman / firebase.json
Last active November 8, 2024 22:28
Sample Firebase hosting configuration for Flutter web.
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [
{
@ditman
ditman / main.dart
Created November 15, 2019 00:24
await (Function) fn(); for non async fns
Future<String> asyncFunctionn() async {
return Future<String>.delayed(
const Duration(milliseconds: 10),
() => "Async function",
);
}
String syncFunction() {
return "Sync function";
}
@ditman
ditman / main.dart
Last active October 30, 2019 19:16
Flutter plugins with implements PlatformInterface
// Provided by flutter/plugins or similar
class Plugin {
@override
void noSuchMethod(Invocation i) {
throw Exception('Plugin does not implement method ${i.memberName}');
}
}
class MockPlugin extends Plugin {
@override
@ditman
ditman / main.dart
Created August 23, 2019 21:47
This gist is a small Flutter app that reproduces a (re)layout error. Use this as your main.dart in a hello_world app.
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: RelayoutBoundariesCrash(),
@ditman
ditman / gist:3772090
Created September 23, 2012 15:48
Basic JS inheritance
// Constructor function. Code run by the "new" operator
var Rabbit = function(name) {
// All Rabbit instances have their own property "name"
this.name = name;
}
// All Rabbit instances can speak, of course!
Rabbit.prototype.speak = function(what) {
return this.name + " says: " + what;
}