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
// Real libraries and modules. | |
library search; | |
import 'dart:async' show Future; | |
import 'package:flutter/http.dart' as http; | |
// Future (aka Promise), type annotations, and top-level functions! | |
// And yes, async/await without translators! | |
Future<List<SearchResult>> fetchResults(String query) async { | |
// single-quote strings, and string interpolation! |
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 'package:flutter/material.dart'; | |
void main() { | |
runApp( | |
new MaterialApp( | |
title: "Flutter Demo", | |
routes: <String, RouteBuilder>{ | |
'/': (RouteArguments args) => new FlutterDemo() | |
} | |
) |
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
sayHi() { | |
print('hi'); | |
} |
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 'package:flutter/material.dart' | |
show | |
BuildContext, | |
Positioned, | |
Stack, | |
State, | |
StatefulComponent, | |
Text, | |
Widget, | |
runApp; |
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
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
#core_header_panel { |
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'; | |
import 'package:smoke/smoke.dart' as smoke; | |
@MirrorsUsed(targets: const [SimpleWithMirrors, Simple], override: '*') | |
import 'dart:mirrors'; | |
class Simple { | |
int id; | |
String name; |
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
name: testjsinterop | |
description: A sample web application | |
dependencies: | |
browser: any | |
js: any | |
quiver: any |
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'; | |
// http://en.wikipedia.org/wiki/Bubble_sort | |
void bubble(List list) { | |
var n = list.length; | |
while (n != 0) { | |
var newn = 0; | |
for (var i = 1; i < n; i++) { | |
if (list[i-1] > list[i]) { |
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'; | |
@lazy | |
import 'big_lib.dart' as big show soManyFunctions; | |
const lazy = const DeferredLibrary('big', uri: 'big.js'); | |
void main() { | |
lazy.load().then((_) { | |
big.soManyFunctions(); |
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:collection'; | |
void main() { | |
var list = new WatchList([1,2,3,4,5]); | |
var mapped = list.where((x) => x.isEven).map((x) => x*2); | |
// What is printed here? | |
print(list.accessCount); |