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 'package:flutter/material.dart'; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override |
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 'package:flutter/material.dart'; | |
import 'package:flutter_bloc/flutter_bloc.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); |
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 'package:async/async.dart'; | |
void main() async { | |
final cancellableOperation = CancelableOperation.fromFuture(operation()); | |
cancellableOperation.then((p0) => print('cancelable operation finished normally'), | |
onCancel: () => print('cancelable operation was canceled')); | |
await Future.delayed(Duration(seconds: 1)).then((_) { | |
cancellableOperation.cancel(); | |
print('operation cancelled'); | |
}); |
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
// Copyright (c) 2019, 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 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
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() { | |
final inter = 23.96; | |
final minVal = 23.6; | |
final list1 = List.generate(5, (i) => minVal + i * inter); | |
print(list1); | |
int i = 0; | |
double val = minVal; | |
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() { | |
final fib = fibStream(); | |
print(fib.take(10)); | |
} | |
Iterable<int> fibStream() sync* { | |
final firstIt = fromList([0]).followedBy(fibStream()); | |
final secondIt = fromList([0,1]).followedBy(fibStream());; | |
yield* zipWith(sumInt, firstIt, secondIt); | |
} |
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 'package:meta/meta.dart'; | |
void runner() { | |
try { | |
repository(); | |
} on RepositoryException catch (error, stackTrace) { | |
// Usually here you not only can log it but show some meaningfull information | |
// based on [RepositoryException.type]. So you don't even need to know how works // repository inside. | |
print('error: $error\nStackTrace:$stackTrace'); | |
} |
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 'package:flutter/widgets.dart'; | |
import 'new_sb_base.dart'; | |
class MyStreamBuilder<T> extends MyStreamBuilderBase<T, AsyncSnapshot<T>> { | |
/// Creates a new [MyStreamBuilder] that builds itself based on the latest | |
/// snapshot of interaction with the specified [stream] and whose build | |
/// strategy is given by [builder]. | |
/// | |
/// The [initialData] is used to create the initial snapshot. | |
/// |
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 'package:flutter/material.dart'; | |
abstract class MyStreamBuilderBase<T, S> extends StatefulWidget { | |
/// Creates a [MyStreamBuilderBase] connected to the specified [stream]. | |
const MyStreamBuilderBase({ Key key, this.stream }) : super(key: key); | |
/// The asynchronous computation to which this builder is currently connected, | |
/// possibly null. When changed, the current summary is updated using |
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 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key key}) : super(key: key); |
NewerOlder