This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Detect Ad Blockers | |
* | |
* Copyright (c) 2020 Four And A Half Giraffes, Ltd. | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class State with ChangeNotifier { | |
late num _count; | |
num get count => _count; | |
void setCount(newCount) { | |
_count = newCount; | |
notifyListeners(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PaymentLine { | |
double price; | |
String name; | |
int qty; | |
PaymentLine({ this.price, this.name, this.qty }); | |
} | |
void main() { | |
List<PaymentLine> payments = <PaymentLine>[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
/// Describes a distance unit for conversion | |
enum Unit { | |
miles, | |
kilometers, | |
nauticalMiles, | |
} | |
/// Describes a decimal coordinate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:mirrors'; | |
class User { | |
final String email; | |
final String name; | |
const User({required this.email, required this.name}); | |
} | |
extension DeclarationMirrorExtension on DeclarationMirror { | |
/// Name of this object or field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("JamesPerihIsCool".replace(/(?<!^)(?=[A-Z])/g, ' ')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> doAThing() async { | |
await Future.delayed(Duration(milliseconds: 500)); | |
try { | |
print('Trying a dangerous thing...'); | |
await doADangerousThing(); | |
} catch (e) { | |
print('There was a minor error: $e'); | |
rethrow; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Describes a television screen resolution | |
class ResolutionSize { | |
/// The natural width of this resolution | |
final int width; | |
/// The natural height of this resolution | |
final int height; | |
/// A shorter technical name | |
final String name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Oct 23, 2020 | |
/// Updated March 17, 2021 | |
/// (c) 2020 James Robert Perih c/o Four And A Half Giraffes, Ltd. | |
void main() { | |
const int theStart = 1; | |
const int theEnd = 100; | |
DartFlutterOutputFactory().printIteration( | |
from: theStart, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:async'; | |
import 'dart:math'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class RandomNumberStream { | |
final StreamController<int> _nextRandomNumberController = StreamController<int>(); |
OlderNewer