-
git init(if project is not git repository).
-
install node:
brew install node
This file contains hidden or 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
#!/bin/bash | |
# Read pubspec.yaml | |
file="pubspec.yaml" | |
# Use grep and sed to find and increment the build number | |
if grep -qE "version: [0-9]+\.[0-9]+\.[0-9]+\+[0-9]+" "$file"; then | |
# Get the current build number | |
current_build=$(grep -E "version: [0-9]+\.[0-9]+\.[0-9]+\+[0-9]+" "$file" | sed -E "s/version: [0-9]+\.[0-9]+\.[0-9]+\+([0-9]+)/\1/") | |
This file contains hidden or 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:async'; | |
import 'dart:math'; | |
import 'package:collection/collection.dart'; | |
extension on int { | |
int get mb => this * 1024 * 1024; | |
} | |
void main() { | |
DownloadPool pool = DownloadPool(maxTaskCount: 5, maxDownloadSpeed: 2.mb); |
This file contains hidden or 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
// function void | |
typedef FunctionVoid = void Function(); | |
// function0 | |
typedef Function0<T> = T Function(); | |
// function1 | |
typedef Function1<T, A> = T Function(A a); | |
// uncurry function2 | |
typedef UncurryFunction2<T, A, B> = T Function(A a, B b); |
This file contains hidden or 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:io'; | |
import 'package:path/path.dart' as path; | |
class FileUtil { | |
static File getUniqueFile(String folderName, final String? fileName) { | |
int num = 1; | |
String destFileName = | |
fileName ?? '${DateTime.now().millisecondsSinceEpoch}'; |
This file contains hidden or 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
#!/bin/bash | |
# 0. init git repository | |
git init | |
# 1. install node | |
brew install node | |
# 2. add conventional commit folders to .gitignore | |
echo " |
This file contains hidden or 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
mixin Dog { | |
void run() { | |
print('Dog run'); | |
} | |
void walk() { | |
print('Dog walk'); | |
} | |
} |
This file contains hidden or 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 HairColorNotifier extends ValueNotifier<int> { | |
HairColorNotifier(int value1) : super(value1); | |
} | |
class HairColorInheritedWidget extends InheritedNotifier<HairColorNotifier> { | |
HairColorInheritedWidget( | |
{Key? key, required Widget child, required HairColorNotifier notifier}) | |
: super(key: key, child: child, notifier: notifier); |
This file contains hidden or 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
void main() { | |
print('gist for dart'); | |
} |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
NewerOlder