Skip to content

Instantly share code, notes, and snippets.

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

Andrew Brogdon RedBrogdon

💭
Flutterin'.
View GitHub Profile
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
This is a seriously long hint. Like, super-duper long.
@RedBrogdon
RedBrogdon / main.dart
Created June 26, 2023 20:59
mellow-illusion-3502
import 'package:flutter/material.dart';
//Import the font package
import 'package:google_fonts/google_fonts.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@RedBrogdon
RedBrogdon / main.dart
Last active February 7, 2023 08:00
DartPad Various Discs sample
import 'dart:math';
import 'package:flutter/material.dart';
class DiscData {
static final _rng = Random();
double size;
Color color;
Alignment alignment;
@RedBrogdon
RedBrogdon / main.dart
Last active March 22, 2022 15:22
Snippet 7: Promotion with exceptions
// Promotion works with exceptions as well
// as return statements. Try a null check
// that throws an `Exception` instead of
// returning zero.
int getLength(String? str) {
// Try throwing here if `str` is null.
return str.length;
}
@RedBrogdon
RedBrogdon / main.dart
Last active July 12, 2021 21:17
Snippet 8: The assertion operator
// If you'd like to assign a nullable expression
// to a variable that's non-nullable, you can use
// the assertion operator (the exclamation point:
// `!`). By adding `!` just after the expression,
// you tell Dart that the value won't be null,
// and it's safe to assign to a non-nullable
// variable.
//
// Note: if you're wrong, an exception will be
// thrown!
@RedBrogdon
RedBrogdon / main.dart
Created September 19, 2019 04:50
Flutter.dev example 2
import 'package:flutter_web/material.dart';
import 'package:flutter_web_ui/ui.dart' as ui;
void main() async {
await ui.webOnlyInitializePlatform();
final numbers = FibonacciNumbers();
runApp(
MaterialApp(
home: Scaffold(
@RedBrogdon
RedBrogdon / main.dart
Last active March 2, 2021 19:14
Sunflower example (null safe)
// 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 'dart:math' as math;
import 'package:flutter/material.dart';
final Color primaryColor = Colors.orange;
final TargetPlatform platform = TargetPlatform.android;
@RedBrogdon
RedBrogdon / main.dart
Last active February 5, 2021 17:39 — forked from legalcodes/main.dart
Image class
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
class MyClass {
int? anInt;
}
class MyOtherClass extends MyClass {
int count = 0;
int? get anInt {
count++;
return count % 2 == 1 ? 1 : null;
abstract class C {
abstract int x1;
abstract var y1;
abstract final z;
abstract final int u1;
abstract covariant int v1;
abstract covariant var w;
}
class D extends C {