Skip to content

Instantly share code, notes, and snippets.

View Luckey-Elijah's full-sized avatar
🦢
Working from home

Elijah Luckey Luckey-Elijah

🦢
Working from home
  • InsuranceToolkits
  • Florida
  • 18:33 (UTC -04:00)
View GitHub Profile
@Luckey-Elijah
Luckey-Elijah / main.dart
Created January 22, 2021 20:07
Wrapping stream and working with data.
void main() async {
// This is where you would use a StreamBuilder rather than this use.
await for (var value in getData()) {
print(value);
}
print('Done!');
/*
* return StreamBuilder(
* stream: getData(),
@Luckey-Elijah
Luckey-Elijah / main.dart
Last active February 9, 2021 18:50
Wrapping text for a row widget
// Code snippet added to hleo answer StackOverflow question: https://stackoverflow.com/questions/66124352
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@Luckey-Elijah
Luckey-Elijah / main.dart
Created February 22, 2021 21:17
An app for visualizing human life in weeks. Use DartPad.dev to view in the browser. Inspired by filiph's human-life. https://github.com/filiph/human-life
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(HumanLifeApp());
}
class HumanLifeApp extends StatelessWidget {
final settings = HumanLifeSettings();
@Luckey-Elijah
Luckey-Elijah / widgets_and_conditional_spread_operators.dart
Last active March 16, 2021 20:50
A simple example of using the spread (`...`) operator within a list of widgets conditionally.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(shouldBuildList: false),
);
@Luckey-Elijah
Luckey-Elijah / country_enum.dart
Last active April 11, 2021 18:13
A country code enum object and extension for dart lang. This is a very large file ~1200 lines of code.
/// All country codes. To access the string of the enum,
/// try using the [codeToString] extension method.
enum Country {
/// Afghanistan
AF,
/// Åland Islands
AX,
/// Albania
@Luckey-Elijah
Luckey-Elijah / controller_builder.dart
Last active August 11, 2022 18:20 — forked from lukepighetti/text_editing_controller_builder.dart
Wrap any TextField with TextEditingControllerBuilder to make it declarative
import 'package:flutter/widgets.dart';
/// {@template text_controller_builder}
/// Exposes a controller (of type [C]) to the child.
/// Used to convert any TextField into a declarative version.
///
///
/// ```dart
/// TextControllerBuilder<MyTextEditingController>(
/// create: () => MyTextEditingController()..doSomethingSpecialOnCreate(),
@Luckey-Elijah
Luckey-Elijah / main.dart
Created October 4, 2021 20:55
Flutter mixin examples
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Mixin Demo',
home: HomePage(),
@Luckey-Elijah
Luckey-Elijah / main.dart
Last active June 16, 2022 18:14
switch_vs_if_else
import 'dart:math';
/// A small test to test the performance of
/// `if-else` statements to `switch-case` statements.
///
/// The same [Stopwatch] and [Random] are use for the entire test.
/// Each one-to-one execution of a test (5 in total) uses a new list of
/// random values to iterate through to create identical scenarios.
///
///
@Luckey-Elijah
Luckey-Elijah / cached_streamable.dart
Last active July 20, 2022 18:07
Cached Streamable class
import 'dart:async';
import 'package:meta/meta.dart';
/// {@template cached_streamable}
/// Extend this class for a streamable, single-data type repository.
/// {@endtemplate}
abstract class CachedStreamable<T> {
/// {@macro cached_streamable}
CachedStreamable({
required T initialState,
@Luckey-Elijah
Luckey-Elijah / readme.md
Last active July 7, 2022 20:37
Flutte upload to tesflight
  1. Run flutter build ipa --release -t lib/main/production.dart

    $ flutter build ipa
    Archiving com.example.example...
    Automatically signing iOS for device deployment using specified development team in Xcode project: J........Z
    Running pod install...
    Running Xcode build...
    └─Compiling, linking and signing...

Xcode archive done.