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:convert' as conv; | |
void main() { | |
Map<int, Map<String, dynamic>> aa = { | |
5: { | |
'hello': 1 | |
} | |
}; | |
print('aa: $aa'); |
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 foo({String bar = 'hi'}) { | |
print(bar); | |
} | |
void main() async { | |
bool s = true; | |
foo(bar: s ? 'hello' : null); | |
s = false; |
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 Complex { | |
num _real; | |
num _imaginary; | |
num get real => _real; | |
num get imaginary => _imaginary; | |
set real(num r) { | |
if(r < 0) return; | |
_real = r; | |
} |
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 Complex { | |
num _real; | |
num _imaginary; | |
num get real => _real; | |
num get imaginary => _imaginary; | |
set real(num r) { | |
if(r < 0) return; | |
_real = r; | |
} |
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 A<T extends dynamic> { | |
Function(A<T>) go; | |
} | |
class B<T extends dynamic> extends A<T> { | |
} | |
void main() async { |
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
{ | |
"info": { | |
"_postman_id": "79c9c0a7-a552-4cef-85f9-9a7d4f3bf343", | |
"name": "Nutror", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "courses", | |
"item": [ |
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'; | |
class A { | |
var ctrl = StreamController(); | |
var cc = 0; | |
run() { | |
ctrl.stream.forEach((ev) { | |
print(ev ?? 0); | |
}); |
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
Stream<T> transformInto<T, Y>(Stream<Y> stream, T Function(Y item) fn, | |
{bool? cancelOnError}) { | |
StreamSubscription<T> _change(Stream<Y> input, bool cancelOnError) { | |
late StreamSubscription<Y> subscription; | |
// Create controller that forwards pause, resume and cancel events. | |
final controller = StreamController<T>( | |
onPause: () { | |
subscription.pause(); |
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
extension AdvObj on Object { | |
bool get isNotNull => this != null; | |
} | |
void main() async { | |
String a; | |
print(a.isNotNull ? 'not null' : 'null'); | |
a = 'ooooo'; | |
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
extension AdvObj on Object { | |
bool get isNotNull => this != null; | |
} | |
void main() async { | |
String a; | |
print(a.isNotNull ? 'not null' : 'null'); | |
a = 'ooooo'; | |
OlderNewer