Skip to content

Instantly share code, notes, and snippets.

Building a Web runtime for Flutter:

Yegor yjbanov

Building a Web runtime for Flutter:
View GitHub Profile
yjbanov / quiver_retry_2.dart
Last active Aug 29, 2015
Quiver delay function composition 2
View quiver_retry_2.dart
/// Returns a [Duration] if another attempt needs to be made after
/// waiting for the returned [Duration]. Returns the error object
/// that instructs the retry mechanism to stop trying and report error
/// immediately.
typedef dynamic OnErrorFunc(Object err, int retry, Duration elapsed);
/// `onError` returns either [Duration] or an error object. If [Duration]
/// is returned, the `attempt` function will be retried after waiting
/// for the returned duration, otherwise the retry mechanism gives up
/// and evaluates the [Future] with the the error object.
Future start(
yjbanov / quiver_retry_1.dart
Last active Aug 29, 2015
Quiver delay function composition 1
View quiver_retry_1.dart
typedef Object OnErrorFunc(Object err, int retry, Duration elapsed);
typedef Duration RetryDelayFunc(Object err, int retry, Duration elapsed);
Future start(
AttemptFunc attempt, {
OnErrorFunc onError: retriesInfinite,
RetryDelayFunc retryDelay: delayNone,
Stopwatch runTime})


Streamy is a feature-rich RPC/API framework for applications written using Dart programming language. It relies on Google API Discovery file format for API description. Streamy also provides out-of-the-box JSON-over-REST protocol.

Using Streamy your application can:

  • Access many Google APIs, such as Google Calendar API
  • Talk to your own APIs built using Google Cloud Endpoints
  • Talk to your own APIs hosted on your own servers and described using Google Discovery format
yjbanov / spark-loading-indicator.html
Last active Jan 4, 2016
Spark loading indicator concept
View spark-loading-indicator.html
#loading-indicator {
position: relative;
height: 3px;
overflow: hidden;
#r0 {
yjbanov / tree_code_fmt.dart
Last active Feb 4, 2016
trailing commas for tree-like code in Dart
View tree_code_fmt.dart
// frameworks such as Flutter and UIX encourage users to express their
// UI using tree-like syntaxes.
// unfortunately dartfmt will format this code:
main() {
var componentTree = new MyButton(
title: 'Save',
onClick: () {
View cork_instance_scope_poc.dart
dynamic _createNewInstance(Type type, Provider provider, Injector injector) {
final arguments = false);
return provider.factory(arguments);
/// Vends injectable objects, deciding whether they need to be created or
/// reused.
abstract class Scope {
dynamic getInstance(Type type, Provider provider, Injector injector);
View gist:6819db1440a96c82c1b2b43fdc5f43c4
// contact_editor.dart
// - light-weight annotations
// - DI-related annotations OK
class ContactEditor {
String get name => 'John Doe';
bool isEditing = false;
// contact_editor.html
yjbanov / main.dart
Last active May 24, 2017
sample flutter counter app
View main.dart
import 'package:flutter/widgets.dart';
main() {
runApp(new MyApp());
class MyApp extends StatelessWidget {
build(_) => new Text('Hello, World!');
View app_test.dart
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_travis_sample/main.dart';
void main() {
testWidgets('app should work', (tester) async {
await tester.pumpWidget(new MyApp());
expect(find.text('Hello, World!'), findsOneWidget);
View dart.dx
// Below is a rewrite of the app generated by `flutter create` using a
// hypothetical syntax for a Flutter-oriented Dart language extension,
// called dx (file extension .dx).
// Key properties of the language:
// - Valid Dart is also valid .dx (start by renaming .dart to .dx).
// - Transpiles file-by-file to plain Dart (syntax translation only).
// - Start with strong-mode Dart syntax/semantics, then:
// - Add Flutter-specific keywords: widget, state, build.
You can’t perform that action at this time.