Skip to content

Instantly share code, notes, and snippets.

View RedBrogdon's full-sized avatar
💭
Flutterin'.

Andrew Brogdon RedBrogdon

💭
Flutterin'.
View GitHub Profile
@RedBrogdon
RedBrogdon / main.dart
Last active June 9, 2020 16:41
Snippet 2: Nullable types
// What if you need a variable that can hold a null
// value? You can declare it nullable by adding a
// question mark to the end of the type. In this
// case, try `int?`.
void main() {
int a;
a = null;
print('a is $a.');
}
@RedBrogdon
RedBrogdon / main.dart
Last active June 9, 2020 16:48
Snippet 1: Introducing non-nullable types
// Welcome to the null safety version of DartPad!
// This is the first in a series of code examples
// designed to illustrate the new syntax and
// coding patterns for null safety.
//
// Each snippet starts off in a bad or broken
// state. You’ll probably see warnings from the
// Dart analyzer, and the code probably won't
// compile. But by following the instructions
// and making edits to the code, you can update
@RedBrogdon
RedBrogdon / main.dart
Last active April 27, 2020 21:56
NavigationRail demo
// Flutter code sample for NavigationRail
// This example shows a [NavigationRail] used within a Scaffold with 3
// [NavigationRailDestination]s. The main content is separated by a divider
// (although elevation on the navigation rail can be used instead). The
// `_selectedIndex` is updated by the `onDestinationSelected` callback.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
import 'dart:math';
import 'package:flutter/material.dart';
// Colors.
const crossColor = const Color(0xFF1ABDD5);
const circleColor = const Color(0xFFD8B9FA);
const accentColor = const Color(0xFF90A4AE);
void main() => runApp(MyApp());
import 'package:flutter/material.dart';
import 'dart:ui';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
/*
MIT License
Copyright (c) 2020 Mariano Zorrilla
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
/*
MIT License
Copyright (c) 2020 Mariano Zorrilla
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
//Made with dartpad.dartlang.org <3
import 'dart:async';
import 'package:flutter/material.dart';
final Color cellColor = Colors.lightBlue;
final Color bgColor = new Color.fromARGB(255, 245, 245, 255);
final TargetPlatform platform = TargetPlatform.android;
List<List<bool>> cells;
final width = 700.0, height = 700.0;
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: Center(
child: Image.network(
'http://placekitten.com/200/200',
),
),
),
import 'dart:async';
class MyClass {
final myMap = <String, int>{'zero':0 };
final controller = StreamController<List<int>>();
void addNumber(String s, int i) {
controller.add(myMap.entries.map((e) => e.value).toList());
myMap[s] = i;