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
python3 -m http.server 8080 | |
python3 -m http.server 8081 |
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
// The Official Standard: RFC 5322 | |
final emailRegexp = RegExp( | |
r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$"); | |
void main() { | |
[ | |
'alex.v@gmail.com', | |
'v@gmail.com', | |
'v@3.gmail.com', | |
'@3.gmail.com', |
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
void main() { | |
var now = DateTime.now(); | |
print(now.toUtc()); | |
} |
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:async'; | |
main() async { | |
print(naturalsTo(10).toList()); | |
print(await asynchronousNaturalsTo(10).toList()); | |
print(naturalsDownFrom(10).toList()); | |
print(await periodicGenerator(10).toList()); | |
} | |
Iterable<int> naturalsTo(int n) sync* { |
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:async'; | |
main() async { | |
await periodicStreamSample(); | |
// await streamControllerSample(); | |
// await streamControllerWithPeriodicEmitsAndWaiterSample(); | |
} | |
Future<void> periodicStreamSample() async { | |
final subscription = Stream.periodic( |
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:async'; | |
main() async { | |
//final version = -1; | |
//final version = 0; | |
final version = 1; | |
// use then / catchError | |
print('handle with then-catchError'); | |
checkVersion(version) |
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
abstract class Cache<T> { | |
T getByKey(String key); | |
void setByKey(String key, T value); | |
} | |
class StringCashe extends Cache<String> { | |
var _cache = Map<String, String>(); | |
@override | |
String getByKey(String key) { | |
return _cache[key]; |
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
/// Example 1 | |
/// Enum extension | |
enum NetworkState { | |
unknown, | |
connected, | |
disconnected, | |
} | |
/// NetworkStateExtension | |
extension NetworkStateExt on NetworkState { |
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 | |
class Pesron { | |
String name; // field | |
int age; | |
String description() { | |
// method | |
return '$name, age: $age'; | |
} | |
} |
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' as math; | |
class MyError extends Error {} | |
class MyException implements Exception { | |
MyException([dynamic message]); | |
} | |
void checkValue(int value) { | |
switch(value) { |
NewerOlder