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
// asynchronous data | |
main() async { | |
// Duration interval = Duration(seconds: 1); | |
// Stream<int> stream = Stream<int>.periodic(interval, callback); | |
// List l=[1,2,1,2,3,4,5,6]; | |
// Stream stream = Stream.fromIterable(l); | |
Map<dynamic, int> map = {1: 1, 'a': 10, 'b': 20, 3: 2, 4: 4, 6: 5}; | |
Stream stream = Stream.fromIterable(map.entries); |
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 Bye { | |
int a = 1; | |
} | |
class Say extends Bye { | |
int a = 2; | |
} | |
void printBye<T extends Say>(T b) { | |
print(b); // prints Instance of Bye |
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
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'dart:async'; | |
import 'dart:io'; | |
Future<void> printDailyNewsDigest() async { | |
var newsDigest = await gatherNewsReports(); | |
print(newsDigest); |
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 m; | |
class Animal { | |
void chase(Animal x) { | |
print("Animal $x"); | |
} | |
} | |
class Mouse extends Animal {} |
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:io'; | |
class Logxy { | |
static String sName; | |
static num slog; | |
static Logxy _logger; | |
// Logxy._() : super._(); | |
// Logxy._(this.sName); |
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'; | |
void main() { | |
print(getRandFilename(8)); | |
} | |
String getRandFilename(int fileNameLength) { | |
Random r = Random(); | |
int randF = pow(10, fileNameLength); | |
randF = r.nextInt(randF); |
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
// T is meant to be a Type | |
// E is meant to be an Element (List<E>: a list of Elements) | |
// K is Key (in a Map<K, V>) | |
// V is Value (as a return value or mapped value) | |
class CacheItem<T, V> { | |
T itemToCache; | |
V amountToCache; | |
CacheItem(T this.itemToCache, V this.amountToCache); | |
T get detail => itemToCache; |
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:io'; | |
var x = 4; | |
class xyz {} | |
void arrexpr(num n) => (print(n)); | |
void main() { | |
// print(Platform.pathSeparator); |