library dartrocket;

import "dart:math";
import "dart:async";
import "dart:html" show Element,querySelector;
import "package:stagexl/stagexl.dart" as StageXL;

part "src/core/game.dart";
part "src/core/statemanager.dart";
part "src/core/state.dart";
part "src/core/background.dart";
part "src/core/text.dart";

part "src/animation/transition_function.dart";

part "src/gameobject/sprite.dart";
part "src/gameobject/animated_sprite.dart";
part "src/gameobject/group.dart";

Add new kind of sprites

library dartrocket;

import "dart:math";
import "dart:async";
import "dart:html" show Element,querySelector;
import "package:stagexl/stagexl.dart" as StageXL;

part "src/core/game.dart";
part "src/core/statemanager.dart";
part "src/core/state.dart";
part "src/core/background.dart";
part "src/core/text.dart";

part "src/animation/transition_function.dart";

part "src/gameobject/sprite.dart";
part "src/gameobject/animated_sprite.dart";
part "src/gameobject/interactive_sprite.dart";
part "src/gameobject/full_sprite.dart";
part "src/gameobject/group.dart";


// Copyright 2016 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'value/boolean.dart';
import 'value/identifier.dart';
import 'visitor/interface/value.dart';
import 'visitor/serialize.dart';

export 'value/boolean.dart';
export 'value/color.dart';
export 'value/identifier.dart';
export 'value/list.dart';
export 'value/map.dart';
export 'value/number.dart';
export 'value/string.dart';

abstract class Value {
  /// Whether the value will be represented in CSS as the empty string.
  bool get isBlank => false;

  const Value();

  /*=T*/ accept/*<T>*/(ValueVisitor/*<T>*/ visitor);

  // TODO: call the proper stringifying method
  Value unaryPlus() => new SassIdentifier("+${valueToCss(this)}");

  Value unaryMinus() => new SassIdentifier("-${valueToCss(this)}");

  Value unaryDivide() => new SassIdentifier("/${valueToCss(this)}");

  Value unaryNot() => sassFalse;

  String toString() => valueToCss(this);
}

Remove a TODO that's already been done.

// Copyright 2016 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'value/boolean.dart';
import 'value/identifier.dart';
import 'visitor/interface/value.dart';
import 'visitor/serialize.dart';

export 'value/boolean.dart';
export 'value/color.dart';
export 'value/identifier.dart';
export 'value/list.dart';
export 'value/map.dart';
export 'value/number.dart';
export 'value/string.dart';

abstract class Value {
  /// Whether the value will be represented in CSS as the empty string.
  bool get isBlank => false;

  const Value();

  /*=T*/ accept/*<T>*/(ValueVisitor/*<T>*/ visitor);

  Value unaryPlus() => new SassIdentifier("+${valueToCss(this)}");

  Value unaryMinus() => new SassIdentifier("-${valueToCss(this)}");

  Value unaryDivide() => new SassIdentifier("/${valueToCss(this)}");

  Value unaryNot() => sassFalse;

  String toString() => valueToCss(this);
}


library sprites;

import 'dart:sky';
import 'dart:math' as Math;
import 'package:vector_math/vector_math_64.dart';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/node.dart';
import 'package:sky/framework/scheduler.dart' as scheduler;
import 'package:sky/framework/net/image_cache.dart' as image_cache;

part 'sprite_box.dart';
part 'transform_node.dart';
part 'sprite_node.dart';
part 'image_map.dart';

Fix examples/game to work after Hixie's grand rename.

library sprites;

import 'dart:sky';
import 'dart:math' as Math;
import 'package:vector_math/vector_math_64.dart';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/object.dart';
import 'package:sky/framework/scheduler.dart' as scheduler;
import 'package:sky/framework/net/image_cache.dart' as image_cache;

part 'sprite_box.dart';
part 'transform_node.dart';
part 'sprite_node.dart';
part 'image_map.dart';


//This will be the style guide used for this project
//https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final ucsdBackgrounndColor = const Color(0xFF182B49);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
    );
  }
}

Add appBar and blue theme

//This will be the style guide used for this project
//https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final ucsdBackgroundColor = const Color(0xFF182B49);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'UCSD',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Home(),

    );
  }
}

class HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("UCSD"),
      ),
      body: Container(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  HomeState createState() => new HomeState();
}


// Copyright (c) 2012, 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.

// Test to ensure that dart2js is free of warnings.

// Test annotation to let the test framework know that this file
// should analyze without any warnings.
// @static-clean

#import('../../sdk/lib/_internal/compiler/implementation/dart2js.dart',
    prefix: 'dart2js');

void main() {
  // Do nothing.
}

Revert "Use old import syntax."

// Copyright (c) 2012, 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.

// Test to ensure that dart2js is free of warnings.

// Test annotation to let the test framework know that this file
// should analyze without any warnings.
// @static-clean

import '../../sdk/lib/_internal/compiler/implementation/dart2js.dart'
    as dart2js;

void main() {
  // Do nothing.
}


import 'package:flutter/material.dart';

import 'heading.dart';

class ListTileGroup extends StatelessWidget {
  final String? heading;
  final List<Widget> listTiles;

  const ListTileGroup({
    Key? key,
    this.heading,
    required this.listTiles,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        heading != null
            ? Padding(
                padding: const EdgeInsets.symmetric(horizontal: 8),
                child: Heading(
                  text: heading!,
                ),
              )
            : const SizedBox(height: 0, width: 0),
        Padding(
          padding: EdgeInsets.only(top: heading != null ? 8 : 0),
          child: ClipRRect(
            borderRadius: BorderRadius.circular(4),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: listTiles,
            ),
          ),
        ),
      ],
    );
  }
}

Use 'if' to determine if Heading should display.

import 'package:flutter/material.dart';

import 'heading.dart';

class ListTileGroup extends StatelessWidget {
  final String? heading;
  final List<Widget> listTiles;

  const ListTileGroup({
    Key? key,
    this.heading,
    required this.listTiles,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        if (heading != null)
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 8),
            child: Heading(
              text: heading!,
            ),
          ),
        Padding(
          padding: EdgeInsets.only(top: heading != null ? 8 : 0),
          child: ClipRRect(
            borderRadius: BorderRadius.circular(4),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: listTiles,
            ),
          ),
        ),
      ],
    );
  }
}


#!/usr/bin/env dart
// 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.

library reserved_names_test;

import 'dart:mirrors' as mirrors;

import 'package:unittest/unittest.dart';

import '../lib/protoc.dart' show MessageGenerator;

import 'test_util.dart';

void main() {
  test('testReservedNamesList', () {
    Set<String> names = new Set<String>();
    fillConflictingNames(mirrors.ClassMirror cls) {
      String className = mirrors.MirrorSystem.getName(cls.simpleName);
      names.addAll(
          cls
          .declarations
          .values
          .where((decl) => !decl.isPrivate && decl is !mirrors.VariableMirror)
          .map((m) => mirrors.MirrorSystem.getName(m.simpleName))
          .map((n) => n.startsWith(className + '.')
                      ? n.substring(className.length + 1) : n)
          .toList());
    }

    var cls = mirrors.currentMirrorSystem()
        .libraries[Uri.parse('package:protobuf/protobuf.dart')]
        .classes[#GeneratedMessage];
    do {
      fillConflictingNames(cls);
      cls = cls.superclass;
    } while (cls != null);

    var x = new Set<String>()..addAll(MessageGenerator.reservedNames);
    expect(names.toList()..sort(), equals(x.toList()..sort()));
  });
}

Update test to work with mirrors for Dart 1.1

#!/usr/bin/env dart
// 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.

library reserved_names_test;

import 'dart:mirrors' as mirrors;

import 'package:unittest/unittest.dart';

import '../lib/protoc.dart' show MessageGenerator;

import 'test_util.dart';

void main() {
  test('testReservedNamesList', () {
    Set<String> names = new Set<String>();
    fillConflictingNames(mirrors.ClassMirror cls) {
      String className = mirrors.MirrorSystem.getName(cls.simpleName);
      names.addAll(
          cls
          .declarations
          .values
          .where((decl) => !decl.isPrivate && decl is !mirrors.VariableMirror)
          .map((m) => mirrors.MirrorSystem.getName(m.simpleName))
          .map((n) => n.startsWith(className + '.')
                      ? n.substring(className.length + 1) : n)
          .toList());
    }

    var cls = mirrors.currentMirrorSystem()
        .libraries[Uri.parse('package:protobuf/protobuf.dart')]
        .declarations[#GeneratedMessage];
    do {
      fillConflictingNames(cls);
      cls = cls.superclass;
    } while (cls != null);

    var x = new Set<String>()..addAll(MessageGenerator.reservedNames);
    expect(names.toList()..sort(), equals(x.toList()..sort()));
  });
}


// 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.

library polymer.test.nested_binding_test;

import 'dart:async';
import 'dart:html';
import 'package:polymer/polymer.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';

@CustomTag('my-test')
class MyTest extends PolymerElement {
  final List fruits = toObservable(['apples', 'oranges', 'pears']);

  final _testDone = new Completer();

  MyTest.created() : super.created();

  _runTest(_) {
    expect($['fruit'].text.trim(), 'Short name: [pears]');
    _testDone.complete();
  }

  ready() {
    onMutation($['fruit']).then(_runTest);
  }
}

main() => initPolymer().run(() {
  useHtmlConfiguration();

  setUp(() => Polymer.onReady);

  test('ready called',
      () => (querySelector('my-test') as MyTest)._testDone.future);
});

Remove comprehension object, but return the list of scopes directly instead.

// 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.

library polymer.test.nested_binding_test;

import 'dart:async';
import 'dart:html';
import 'package:polymer/polymer.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';

@CustomTag('my-test')
class MyTest extends PolymerElement {
  final List fruits = toObservable(['apples', 'oranges', 'pears']);

  final _testDone = new Completer();

  MyTest.created() : super.created();

  ready() {
    expect($['fruit'].text.trim(), 'Short name: [pears]');
    _testDone.complete();
  }
}

main() => initPolymer().run(() {
  useHtmlConfiguration();

  setUp(() => Polymer.onReady);

  test('ready called',
      () => (querySelector('my-test') as MyTest)._testDone.future);
});


library aquatics;

import 'dart:html' as html;
import 'dart:math';
import 'dart:async';
import 'package:stagexl/stagexl.dart';

part 'RandomPath.dart';
part 'Aquatic.dart';

void main() {
  var canvas = html.query('#stage');
  var stage = new Stage('myStage', canvas);
  var renderLoop = new RenderLoop();
  renderLoop.addStage(stage);

  var padding = 150;
  var speed = 0.009;
  var scale = 0.05;
  var random = new Random();
  for (int i = 0; i < 22; i++) {
    var x0 = padding + random.nextDouble() * (stage.stageWidth - padding);
    var y0 = padding + random.nextDouble() * (stage.stageHeight - padding);
    scale += 0.025;
    speed += 0.0013;
    var path = new RandomPath(x: x0, y: y0,
        top:50, bottom:stage.stageHeight - 50, left:50, right:stage.stageWidth - 50,
        scale: scale, speed: speed);
    stage.addChild(path);
    path.startLoop();
  }
}

Improve init parameters to center initial vectors

library aquatics;

import 'dart:html' as html;
import 'dart:math';
import 'dart:async';
import 'package:stagexl/stagexl.dart';

part 'RandomPath.dart';
part 'Aquatic.dart';

void main() {
  var canvas = html.query('#stage');
  var stage = new Stage('myStage', canvas);
  var renderLoop = new RenderLoop();
  renderLoop.addStage(stage);

  var padding = 200;
  var speed = 0.008;
  var scale = 0.05;
  var random = new Random();
  for (int i = 0; i < 25; i++) {
    var a0 = 360 * random.nextDouble();
    var x0 = padding + random.nextDouble() * (stage.stageWidth - 2 * padding);
    var y0 = padding + random.nextDouble() * (stage.stageHeight - 2 * padding);
    scale += 0.022;
    speed += 0.0013;
    var path = new RandomPath(x: x0, y: y0, a0: a0,
        top:50, bottom:stage.stageHeight - 50, left:50, right:stage.stageWidth - 50,
        scale: scale, speed: speed);
    stage.addChild(path);
    path.startLoop();
  }
}


/// Calculator from the tutorial.
library petitparser.example.calc;

import 'package:petitparser/petitparser.dart';

void main(List<String> arguments) {
  final number = digit().plus().flatten().trim().map(int.parse);
  final term = undefined();
  final prod = undefined();
  final prim = undefined();
  final start = term.end();

  term.set(prod
      .seq(char('+').trim())
      .seq(term)
      .map((values) => values[0] + values[2])
      .or(prod));
  prod.set(prim
      .seq(char('*').trim())
      .seq(prod)
      .map((values) => values[0] * values[2])
      .or(prim));
  prim.set(char('(')
      .trim()
      .seq(term)
      .seq(char(')'.trim()))
      .map((values) => values[1])
      .or(number));

  print(start.parse(arguments.join(' ')).value);
}

Fix typo also in example

/// Calculator from the tutorial.
library petitparser.example.calc;

import 'package:petitparser/petitparser.dart';

void main(List<String> arguments) {
  final number = digit().plus().flatten().trim().map(int.parse);
  final term = undefined();
  final prod = undefined();
  final prim = undefined();
  final start = term.end();

  term.set(prod
      .seq(char('+').trim())
      .seq(term)
      .map((values) => values[0] + values[2])
      .or(prod));
  prod.set(prim
      .seq(char('*').trim())
      .seq(prod)
      .map((values) => values[0] * values[2])
      .or(prim));
  prim.set(char('(')
      .trim()
      .seq(term)
      .seq(char(')').trim())
      .map((values) => values[1])
      .or(number));

  print(start.parse(arguments.join(' ')).value);
}


part of irc.parser;

/**
 * Represents a Hostmask that has been parsed
 */
class Hostmask {
  static final HOSTMASK_REGEX = new RegExp("[!@]");

  /**
   * Nickname is Hostmask
   */
  String nickname;

  /**
   * User's Identity
   */
  String identity;

  /**
   * User's Hostname
   */
  String hostname;

  /**
   * Creates a Hostmask instance
   */
  Hostmask({this.nickname, this.identity, this.hostname});

  Hostmask.parse(String input) {
    var parts = input.split(HOSTMASK_REGEX);

    this.nickname = parts[0];
    this.identity = parts[1];
    this.hostname = parts[2];
  }
}

/**
 * A Hostmask Pattern
 *
 * This is generally used for Ban Lists
 */
class GlobHostmask {
  /**
   * Hostmask Pattern
   */
  String pattern;

  /**
   * Creates a new Hostmask Pattern
   *
   * [pattern] is the glob pattern
   */
  GlobHostmask(this.pattern);

  /**
   * Checks if [hostmask] matches [pattern]
   */
  bool matches(String hostmask) => new Glob(pattern).hasMatch(hostmask);

  /**
   * Gives a String Representation of this hostmask pattern
   */
  @override
  String toString() => pattern;
}

Fix Typo in [Hostmask] documentation

part of irc.parser;

/**
 * Represents a Hostmask that has been parsed
 */
class Hostmask {
  static final HOSTMASK_REGEX = new RegExp("[!@]");

  /**
   * User's Nickname
   */
  String nickname;

  /**
   * User's Identity
   */
  String identity;

  /**
   * User's Hostname
   */
  String hostname;

  /**
   * Creates a Hostmask instance
   */
  Hostmask({this.nickname, this.identity, this.hostname});

  Hostmask.parse(String input) {
    var parts = input.split(HOSTMASK_REGEX);

    this.nickname = parts[0];
    this.identity = parts[1];
    this.hostname = parts[2];
  }
}

/**
 * A Hostmask Pattern
 *
 * This is generally used for Ban Lists
 */
class GlobHostmask {
  /**
   * Hostmask Pattern
   */
  String pattern;

  /**
   * Creates a new Hostmask Pattern
   *
   * [pattern] is the glob pattern
   */
  GlobHostmask(this.pattern);

  /**
   * Checks if [hostmask] matches [pattern]
   */
  bool matches(String hostmask) => new Glob(pattern).hasMatch(hostmask);

  /**
   * Gives a String Representation of this hostmask pattern
   */
  @override
  String toString() => pattern;
}


// Copyright 2015 The Chromium Authors. 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:sky';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/flex.dart';

AppView app;

void main() {
  var coloredBox = new RenderDecoratedBox(
    decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFF00))
  );
  var shadow = const BoxShadow(
      color: const Color(0xFFEEEEEE), offset: const Size(5.0, 5.0), blur: 5.0);
  var shadowBox = new RenderShadowedBox(shadow: shadow, child: coloredBox);
  var paddedBox = new RenderPadding(padding: const EdgeDims.all(30.0),
      child: shadowBox);
  app = new AppView(paddedBox);
}

Add a proper material shadow the popup menu

// Copyright 2015 The Chromium Authors. 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:sky';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/flex.dart';
import 'package:sky/framework/theme2/shadows.dart';

AppView app;

void main() {
  var coloredBox = new RenderDecoratedBox(
    decoration: new BoxDecoration(
      backgroundColor: const Color(0xFFFAFAFA),
      boxShadow: Shadow[3])
  );
  var paddedBox = new RenderPadding(
    padding: const EdgeDims.all(50.0),
    child: coloredBox);
  app = new AppView(new RenderDecoratedBox(
    decoration: const BoxDecoration(
      backgroundColor: const Color(0xFFFFFFFF)
    ),
    child: paddedBox
  ));
}


import 'package:flutter/material.dart';
import 'package:quiver/strings.dart';

class StatusPage extends StatelessWidget {
  final String message;
  final String? suggestion;
  final Widget? action;
  final bool scrollable;

  const StatusPage({
    Key? key,
    required this.message,
    this.suggestion,
    this.action,
    this.scrollable = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        return SingleChildScrollView(
          physics: scrollable
              ? const AlwaysScrollableScrollPhysics()
              : const NeverScrollableScrollPhysics(),
          child: ConstrainedBox(
            constraints: BoxConstraints(
              minHeight: constraints.maxHeight,
              minWidth: constraints.maxWidth,
            ),
            child: IntrinsicHeight(
              child: Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    message,
                    style: const TextStyle(
                      fontSize: 18,
                    ),
                  ),
                  if (isNotBlank(suggestion)) const SizedBox(height: 8),
                  if (isNotBlank(suggestion))
                    Text(
                      suggestion!,
                      style: const TextStyle(
                        fontSize: 16,
                      ),
                    ),
                  if (action != null) const SizedBox(height: 4),
                  if (action != null) action!,
                ],
              ),
            ),
          ),
        );
      },
    );
  }
}

Update StatusPage to use Gap instead of SizedBox.

import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:quiver/strings.dart';

class StatusPage extends StatelessWidget {
  final String message;
  final String? suggestion;
  final Widget? action;
  final bool scrollable;

  const StatusPage({
    Key? key,
    required this.message,
    this.suggestion,
    this.action,
    this.scrollable = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        return SingleChildScrollView(
          physics: scrollable
              ? const AlwaysScrollableScrollPhysics()
              : const NeverScrollableScrollPhysics(),
          child: ConstrainedBox(
            constraints: BoxConstraints(
              minHeight: constraints.maxHeight,
              minWidth: constraints.maxWidth,
            ),
            child: IntrinsicHeight(
              child: Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    message,
                    style: const TextStyle(
                      fontSize: 18,
                    ),
                  ),
                  if (isNotBlank(suggestion)) const Gap(8),
                  if (isNotBlank(suggestion))
                    Text(
                      suggestion!,
                      style: const TextStyle(
                        fontSize: 16,
                      ),
                    ),
                  if (action != null) const Gap(4),
                  if (action != null) action!,
                ],
              ),
            ),
          ),
        );
      },
    );
  }
}


import 'package:endpoints/endpoints.dart';
import 'package:cloud_datastore/cloud_datastore.dart';

@ModelMetadata(const ScoreDesc())
class Score extends Model {
  @ApiProperty(description: 'Datastore ID of the Score', variant: 'uint64')
  int id;

  @ApiProperty(description: 'Result of the game.')
  String outcome;

  @ApiProperty(description: 'Time stamp, will be added automatically when the score is recorded.')
  DateTime played;

  @ApiProperty(description: 'Google ID of the player')
  String player;

  Score() {
    // Automatically set current date for new messages
    played = new DateTime.now();
  }
}

class ScoreDesc extends ModelDescription {
  final id = const IntProperty();
  final outcome = const StringProperty();
  final played = const DateTimeProperty();
  final player = const StringProperty();

  const ScoreDesc() : super ('Message');
}

class ScoreList {
  List<Score> items;

  ScoreList([this.items = const []]);
}

class ScoreListRequest {
  @ApiProperty(description: 'Number of scores to return in one request')
  int limit;

  @ApiProperty(description: 'Sort order of scores in response')
  String order;
}

class ScoreRequest {
  @ApiProperty(description: 'Score to be inserted')
  String outcome;
}

class Board {
  @ApiProperty(description: 'Current state of the game')
  String state;
}

Add enum property for order

import 'package:endpoints/endpoints.dart';
import 'package:cloud_datastore/cloud_datastore.dart';

@ModelMetadata(const ScoreDesc())
class Score extends Model {
  @ApiProperty(description: 'Datastore ID of the Score', variant: 'uint64')
  int id;

  @ApiProperty(description: 'Result of the game.')
  String outcome;

  @ApiProperty(description: 'Time stamp, will be added automatically when the score is recorded.')
  DateTime played;

  @ApiProperty(description: 'Google ID of the player')
  String player;

  Score() {
    // Automatically set current date for new messages
    played = new DateTime.now();
  }
}

class ScoreDesc extends ModelDescription {
  final id = const IntProperty();
  final outcome = const StringProperty();
  final played = const DateTimeProperty();
  final player = const StringProperty();

  const ScoreDesc() : super ('Message');
}

class ScoreList {
  List<Score> items;

  ScoreList([this.items = const []]);
}

class ScoreListRequest {
  @ApiProperty(description: 'Number of scores to return in one request')
  int limit;

  @ApiProperty(
    values: const {
      'WHEN': 'Return most recent scores first',
      'TEXT': 'Return scores sorted by outcome value'
    },
    description: 'Sort order of scores in response'
  )
  String order;
}

class ScoreRequest {
  @ApiProperty(description: 'Score to be inserted')
  String outcome;
}

class Board {
  @ApiProperty(description: 'Current state of the game')
  String state;
}


import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';
import 'trips_history.dart';

@Controller(
    selector: '[trips-history]',
    publishAs: 'ctrl')
class TripsHistoryController {
  List<Person> people = new List();
  String personName;
  String personColour;

  void addPerson() {
    var person = new Person(personName, personColour);
    people.add(person);
    personName = '';
    personColour = '';
  }
}

class TripsHistoryModule extends Module {

  TripsHistoryModule() {
    type(TripsHistoryController);
  }
}

main() {
  applicationFactory()
      .addModule(new TripsHistoryModule())
      .run();
}

Add some temporary example people

import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';
import 'trips_history.dart';

@Controller(
    selector: '[trips-history]',
    publishAs: 'ctrl')
class TripsHistoryController {
  List<Person> people = new List();
  String personName;
  String personColour;

  TripsHistoryController() {
    // TODO: remove example people.
    var a = new Person('Andrea', '#EEEE00');
    var b = new Person('Brett', '#0000EE');
    var ab = new Person('Andrea & Brett', '#00EE00');
    people.add(a);
    people.add(b);
    people.add(ab);
  }

  void addPerson() {
    var person = new Person(personName, personColour);
    people.add(person);
    personName = '';
    personColour = '';
  }
}

class TripsHistoryModule extends Module {

  TripsHistoryModule() {
    type(TripsHistoryController);
  }
}

main() {
  applicationFactory()
      .addModule(new TripsHistoryModule())
      .run();
}


import 'package:flutter/material.dart';
import './book-list.dart';

void main() => runApp(BuddyBible());

class BuddyBible extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Buddy Bible',
      home: Home()
    );
  }
}

class Home extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(
          'Buddy Bible',
          style: TextStyle(color: Colors.black),
        ),
        bottom: PreferredSize(
          child: Padding(
            padding: EdgeInsets.only(bottom: 6),
            child: Text(
              'Your daily bible assistant',
              style: TextStyle(color: Colors.grey.shade600, fontSize: 16, fontWeight: FontWeight.w300),
            ),
          ),
          preferredSize: null,
        ),
        elevation: 0.4,
        backgroundColor: Colors.white
      ),
      backgroundColor: Colors.white,
      body: BookList()
    );
  }
}

Remove app bar and wrapper on book list page

import 'package:flutter/material.dart';
import './book-list.dart';

void main() => runApp(BuddyBible());

class BuddyBible extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Buddy Bible',
      home: Home()
    );
  }
}

class Home extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return BookList();
  }
}


// Copyright (c) 2011, 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.

class DOMWrapperBase extends NativeFieldWrapperClass2 implements DOMType {
  var dartObjectLocalStorage;
}

Adjust native field wrapper field count.

// Copyright (c) 2011, 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.

class DOMWrapperBase extends NativeFieldWrapperClass1 implements DOMType {
  var dartObjectLocalStorage;
}


import 'package:flutter/foundation.dart' show BindingBase;
import 'package:flutter/widgets.dart' show Element;

/// If you need your provider to be notified when 'Hot Reload' occurs,
/// use this class
///
/// '''dart
/// class MyChangeNotifier extends ChangeNotifier with ReassembleHandler {}
/// '''
abstract class ReassembleHandler {
  /// Called when 'Hot Reload' occurs
  ///
  /// See also:
  ///
  ///  * [Element.reassemble]
  ///  * [BindingBase.reassembleApplication]
  void reassemble();
}

Fix ReassembleHandler example in class docs

import 'package:flutter/foundation.dart' show BindingBase;
import 'package:flutter/widgets.dart' show Element;

/// If you need your provider to be notified when 'Hot Reload' occurs,
/// use this class
///
/// ```dart
/// class MyChangeNotifier extends ChangeNotifier with ReassembleHandler {}
/// ```
abstract class ReassembleHandler {
  /// Called when 'Hot Reload' occurs
  ///
  /// See also:
  ///
  ///  * [Element.reassemble]
  ///  * [BindingBase.reassembleApplication]
  void reassemble();
}


import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../state.dart';
import 'device_avatar.dart';
import 'device_picker_dialog.dart';

class DeviceButton extends ConsumerWidget {
  final double radius;
  const DeviceButton({super.key, this.radius = 16});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final deviceNode = ref.watch(currentDeviceProvider);
    final deviceData = ref.watch(currentDeviceDataProvider);
    Widget deviceWidget;
    if (deviceNode != null) {
      if (deviceData != null) {
        deviceWidget = DeviceAvatar.yubiKeyData(
          deviceData,
          selected: true,
          radius: radius,
        );
      } else {
        deviceWidget = DeviceAvatar.deviceNode(
          deviceNode,
          selected: true,
          radius: radius,
        );
      }
    } else {
      deviceWidget = DeviceAvatar(
        radius: radius,
        child: const Icon(Icons.more_horiz),
      );
    }
    return Padding(
      padding: const EdgeInsets.only(right: 8.0),
      child: IconButton(
        tooltip: 'Select YubiKey or device',
        icon: OverflowBox(
          maxHeight: 44,
          maxWidth: 44,
          child: deviceWidget,
        ),
        onPressed: () {
          showDialog(
            context: context,
            builder: (context) => const DevicePickerDialog(),
          );
        },
      ),
    );
  }
}

Use USB icon for no device when in USB mode.

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../state.dart';
import 'device_avatar.dart';
import 'device_picker_dialog.dart';

class DeviceButton extends ConsumerWidget {
  final double radius;
  const DeviceButton({super.key, this.radius = 16});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final deviceNode = ref.watch(currentDeviceProvider);
    final deviceData = ref.watch(currentDeviceDataProvider);
    Widget deviceWidget;
    if (deviceNode != null) {
      if (deviceData != null) {
        deviceWidget = DeviceAvatar.yubiKeyData(
          deviceData,
          selected: true,
          radius: radius,
        );
      } else {
        deviceWidget = DeviceAvatar.deviceNode(
          deviceNode,
          selected: true,
          radius: radius,
        );
      }
    } else {
      deviceWidget = DeviceAvatar(
        radius: radius,
        selected: true,
        child: const Icon(Icons.usb),
      );
    }
    return Padding(
      padding: const EdgeInsets.only(right: 8.0),
      child: IconButton(
        tooltip: 'Select YubiKey or device',
        icon: OverflowBox(
          maxHeight: 44,
          maxWidth: 44,
          child: deviceWidget,
        ),
        onPressed: () {
          showDialog(
            context: context,
            builder: (context) => const DevicePickerDialog(),
          );
        },
      ),
    );
  }
}


library dartdoc_runner.cleaners.package_cleaner;

import 'dart:async';
import 'dart:io';

import 'package:dartdoc_runner/config.dart';
import 'package:dartdoc_runner/package.dart';
import 'package:logging/logging.dart';

var _logger = new Logger("package_cleaner");

class PackageCleaner {
  final Config config;
  PackageCleaner(this.config);

  Future<Null> delete(Iterable packages) async {
    var futures = packages.map((Package package) async {
      _logger.info("Deleting pubcache and output directory for the package $package");
      await new Directory(package.pubCacheDir(config)).delete(recursive: true);
      await new Directory(package.outputDir(config)).delete(recursive: true);
    });
    await Future.wait(futures);
  }
}

Make sure we don't delete the packages dartdocs-generator depends on

library dartdoc_runner.cleaners.package_cleaner;

import 'dart:async';
import 'dart:io';

import 'package:dartdoc_runner/config.dart';
import 'package:dartdoc_runner/package.dart';
import 'package:logging/logging.dart';
import 'package:yaml/yaml.dart' as yaml;
import 'package:dartdoc_runner/version.dart';

var _logger = new Logger("package_cleaner");

class PackageCleaner {
  final Config config;
  PackageCleaner(this.config);

  Future<Null> delete(Iterable packages) async {
    var futures = packages.map((Package package) async {
      _logger.info("Deleting output directory for the package $package");
      await new Directory(package.outputDir(config)).delete(recursive: true);
      if (!_usedByDartDocGeneratorPackages.contains(package)) {
        _logger.info("Deleting pubcache directory for the package $package");
        await new Directory(package.pubCacheDir(config)).delete(recursive: true);
      }
    });
    await Future.wait(futures);
  }

  Set<Package> _usedByDartDocGeneratorPackagesMemoizer;
  Set<Package> get _usedByDartDocGeneratorPackages {
    if (_usedByDartDocGeneratorPackagesMemoizer == null) {
      Map<String, Map<String, String>> lockfile = yaml.loadYaml(new File("pubspec.lock").readAsStringSync())["packages"];
      var packages = new Set();
      lockfile.forEach((String key, Map<String, String> values) {
        packages.add(new Package(key, new Version(values["version"])));
      });
      _usedByDartDocGeneratorPackagesMemoizer = packages;
    }
    return _usedByDartDocGeneratorPackagesMemoizer;
  }
}


// Copyright 2015 The Chromium Authors. 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:sky';

double timeBase = null;

Image image;

void beginFrame(double timeStamp) {
  if (timeBase == null) timeBase = timeStamp;
  double delta = timeStamp - timeBase;
  PictureRecorder canvas = new PictureRecorder(view.width, view.height);
  canvas.translate(view.width / 2.0, view.height / 2.0);
  canvas.rotateDegrees(delta / 10);
  canvas.scale(0.2, 0.2);
  Paint paint = new Paint()..setARGB(255, 0, 255, 0);
  canvas.drawImage(image, -image.width / 2.0, -image.height / 2.0, paint);
  view.picture = canvas.endRecording();
  view.scheduleFrame();
}

void main() {
  image = new Image();
  image.src = "https://www.dartlang.org/logos/dart-logo.png";
  view.setBeginFrameCallback(beginFrame);
  view.scheduleFrame();
}

Refactor image handling in Sky to expose the loader and image as separate classes to Dart code. This makes it possible to avoid unnecessary paints, by only painting once when the image has loaded. Now that we've separated the loader and image classes, we can implement an image cache in Dart.

// Copyright 2015 The Chromium Authors. 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:sky';

double timeBase = null;

Image image = null;

void beginFrame(double timeStamp) {
  if (timeBase == null) timeBase = timeStamp;
  double delta = timeStamp - timeBase;
  PictureRecorder canvas = new PictureRecorder(view.width, view.height);
  canvas.translate(view.width / 2.0, view.height / 2.0);
  canvas.rotateDegrees(delta / 10);
  canvas.scale(0.2, 0.2);
  Paint paint = new Paint()..setARGB(255, 0, 255, 0);
  if (image != null)
    canvas.drawImage(image, -image.width / 2.0, -image.height / 2.0, paint);
  view.picture = canvas.endRecording();
  view.scheduleFrame();
}

void main() {
  new ImageLoader("https://www.dartlang.org/logos/dart-logo.png", (result) {
    if (result != null) {
      print("${result.width}x${result.width} image loaded!");
      image = result;
      view.scheduleFrame();
    } else {
      print("Image failed to load");
    }
  }).load();
  view.setBeginFrameCallback(beginFrame);
}


import 'block_parser.dart';
import 'inline_parser.dart';

class ExtensionSet {
  static ExtensionSet none = new ExtensionSet._([], []);

  static ExtensionSet commonMark = new ExtensionSet._(
      [const FencedCodeBlockSyntax()], [new InlineHtmlSyntax()]);

  static ExtensionSet gitHub = new ExtensionSet._(
      [const FencedCodeBlockSyntax(), const TableSyntax()],
      [new InlineHtmlSyntax()]);

  final List<BlockSyntax> blockSyntaxes;
  final List<InlineSyntax> inlineSyntaxes;

  ExtensionSet._(this.blockSyntaxes, this.inlineSyntaxes);
}

Make ExtensionSet static fields final

import 'block_parser.dart';
import 'inline_parser.dart';

class ExtensionSet {
  static final ExtensionSet none = new ExtensionSet._([], []);

  static final ExtensionSet commonMark = new ExtensionSet._(
      [const FencedCodeBlockSyntax()], [new InlineHtmlSyntax()]);

  static final ExtensionSet gitHub = new ExtensionSet._(
      [const FencedCodeBlockSyntax(), const TableSyntax()],
      [new InlineHtmlSyntax()]);

  final List<BlockSyntax> blockSyntaxes;
  final List<InlineSyntax> inlineSyntaxes;

  ExtensionSet._(this.blockSyntaxes, this.inlineSyntaxes);
}


part of main;

/// This controller is completely arbitrary. You can choose to set up
/// your environment however you like!
class ErrorController {
  Future<Response> general(
      Object exception,
      StackTrace stack) {
    print('<red>Uncaught error!\n$exception</red>');
    return _errorTemplate(exception, stack);
  }

  Future<Response> notFound(
      HttpNotFoundException exception,
      StackTrace stack) {
    return _errorTemplate(exception, stack, 404, {
      'message': "Oops! That page wasn't found!"
    });
  }

  Future<Response> _errorTemplate(
      Object exception,
      StackTrace stack,
      [int code = 500,
      Map<String, dynamic> variables = const {}]) async {

    // Create a template with the specified parameters
    final errorTemplate = await (template('error', withData: variables)
      ..exception = exception
      ..stackTrace = stack
      ..code = code);

    // Return a shelf Response from the template and the params
    return new Response(
        code,
        body: errorTemplate.encoded,
        headers: {
          'Content-Type': ContentType.HTML.toString()
        });
  }
}

Set a constant for the error template to use in ErrorController

part of main;

/// This controller is completely arbitrary. You can choose to set up
/// your environment however you like!
class ErrorController {
  // lib/templates/error.chalk.html
  static const errorTemplate = 'error';

  Future<Response> general(
      Object exception,
      StackTrace stack) {
    print('<red>Uncaught error!\n$exception</red>');
    return _errorTemplate(exception, stack);
  }

  Future<Response> notFound(
      HttpNotFoundException exception,
      StackTrace stack) {
    return _errorTemplate(exception, stack, 404, {
      'message': "Oops! That page wasn't found!"
    });
  }

  Future<Response> _errorTemplate(
      Object exception,
      StackTrace stack,
      [int code = 500,
      Map<String, dynamic> variables = const {}]) async {

    // Create a template with the specified parameters
    final errorTemplate = await (template(errorTemplate, withData: variables)
      ..exception = exception
      ..stackTrace = stack
      ..code = code);

    // Return a shelf Response from the template and the params
    return new Response(
        code,
        body: errorTemplate.encoded,
        headers: {
          'Content-Type': ContentType.HTML.toString()
        });
  }
}


#!/usr/bin/env dart

import 'dart:io';

import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/scanner.dart';

import 'package:async_await/src/error_collector.dart';
import 'package:async_await/src/xform.dart';

main(List<String> args) {
  if (args.length != 1) {
    print('Usage: async_await.dart [file]');
    exit(0);
  }

  var errorListener = new _ErrorCollector();
  var unit = _parse(new File(args.first), errorListener);
  var analysis = new AnalysisVisitor();
  analysis.visit(unit);
  var transform = new AsyncTransformer(analysis.awaits);
  print(transform.visit(unit));

  for (var error in errorListener.errors) {
    print(error);
  }
}

_parse(File file, AnalysisErrorListener errorListener) {
  var src = file.readAsStringSync();
  var reader = new CharSequenceReader(src);
  var scanner = new Scanner(null, reader, errorListener);
  var token = scanner.tokenize();
  var parser = new Parser(null, errorListener);
  parser.parseAsync = true;
  return parser.parseCompilationUnit(token);
}

Fix typo in class name.

#!/usr/bin/env dart

import 'dart:io';

import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/scanner.dart';

import 'package:async_await/src/error_collector.dart';
import 'package:async_await/src/xform.dart';

main(List<String> args) {
  if (args.length != 1) {
    print('Usage: async_await.dart [file]');
    exit(0);
  }

  var errorListener = new ErrorCollector();
  var unit = _parse(new File(args.first), errorListener);
  var analysis = new AnalysisVisitor();
  analysis.visit(unit);
  var transform = new AsyncTransformer(analysis.awaits);
  print(transform.visit(unit));

  for (var error in errorListener.errors) {
    print(error);
  }
}

_parse(File file, AnalysisErrorListener errorListener) {
  var src = file.readAsStringSync();
  var reader = new CharSequenceReader(src);
  var scanner = new Scanner(null, reader, errorListener);
  var token = scanner.tokenize();
  var parser = new Parser(null, errorListener);
  parser.parseAsync = true;
  return parser.parseCompilationUnit(token);
}


import 'package:angular2/core.dart';
import 'package:np8080/document/textdocument.dart';
import 'package:np8080/services/textprocessingservice.dart';

@Component(
    selector: 'generate-dialog',
    templateUrl: 'generate_component.html',
    providers: const [TextProcessingService])
class GenerateDialogComponent {
  @Input()
  bool showDialog = false;

  @Input()
  TextDocument note;

  @Output()
  EventEmitter<bool> showDialogChange = new EventEmitter<bool>();

  String textToRepeat;
  num repeatCount = 10;

  final TextProcessingService _textProcessingService;

  GenerateDialogComponent(this._textProcessingService);

  void closeTheDialog() {
    showDialog = false;
    showDialogChange.emit(showDialog);
  }

  void onSubmit() {
    note.text +=
        _textProcessingService.getRepeatedString(textToRepeat, repeatCount);
  }
}

Reset dialog contents and save changes.

import 'package:angular2/core.dart';
import 'package:np8080/document/textdocument.dart';
import 'package:np8080/services/textprocessingservice.dart';

@Component(
    selector: 'generate-dialog',
    templateUrl: 'generate_component.html',
    providers: const [TextProcessingService])
class GenerateDialogComponent {
  @Input()
  bool showDialog = false;

  @Input()
  TextDocument note;

  @Output()
  EventEmitter<bool> showDialogChange = new EventEmitter<bool>();

  String textToRepeat;
  num repeatCount = 10;

  final TextProcessingService _textProcessingService;

  GenerateDialogComponent(this._textProcessingService);

  void closeTheDialog() {
    textToRepeat = "";
    showDialog = false;
    showDialogChange.emit(showDialog);
  }

  void onSubmit() {
    note.text +=
        _textProcessingService.getRepeatedString(textToRepeat, repeatCount);
    note.save();
  }
}


#library('NativeGCTest');
#import('../../lib/unittest/unittest.dart');
#import('../../lib/unittest/html_config.dart');
#import('dart:html');

main() {
  useHtmlConfiguration();

  test('EventListener', () {
      final int N = 1000000;
      final int M = 1000;

      var div;
      for (int i = 0; i < M; ++i) {
        // This memory should be freed when the listener below is
        // collected.
        List l = new List(N);

        // Record the iteration number.
        l[N - 1] = i;

        div = new Element.tag('div');
        div.on['test'].add((_) {
            // Only the final iteration's listener should be invoked.
            // Note: the reference to l keeps the entire list alive.
            Expect.equals(M - 1, l[N - 1]);
          }, false);
      }

      final event = new Event('test');
      div.on['test'].dispatch(event);
  });
}

Add test for garbage collected window event listeners issue.

#library('NativeGCTest');
#import('../../lib/unittest/unittest.dart');
#import('../../lib/unittest/html_config.dart');
#import('dart:html');

main() {
  useHtmlConfiguration();

  test('EventListener', () {
      final int N = 1000000;
      final int M = 1000;

      var div;
      for (int i = 0; i < M; ++i) {
        // This memory should be freed when the listener below is
        // collected.
        List l = new List(N);

        // Record the iteration number.
        l[N - 1] = i;

        div = new Element.tag('div');
        div.on['test'].add((_) {
            // Only the final iteration's listener should be invoked.
            // Note: the reference to l keeps the entire list alive.
            Expect.equals(M - 1, l[N - 1]);
          }, false);
      }

      final event = new Event('test');
      div.on['test'].dispatch(event);
  });

  test('WindowEventListener', () {
    Element testDiv = new DivElement();
    testDiv.id = '#TestDiv';
    document.body.nodes.add(testDiv);
    window.on.message.add((e) => testDiv.click());

    for (int i = 0; i < 100; ++i) {
      triggerMajorGC();
    }

    testDiv.on.click.add(expectAsync1((e) {}));
    window.postMessage('test', '*');
  });
}

void triggerMajorGC() {
  List list = new List(1000000);
  Element div = new DivElement();
  div.on.click.add((e) => print(list[0]));
}


library dart_coveralls.coveralls_endpoint;

import 'dart:async' show Future;
import 'dart:convert' show JSON;

import 'package:http/http.dart' show MultipartRequest, MultipartFile, Response;

import 'coveralls_entities.dart';
import 'log.dart';

class CoverallsEndpoint {
  static const String COVERALLS_ADDRESS = "https://coveralls.io/api/v1/jobs";

  final Uri coverallsAddress;

  CoverallsEndpoint([coverallsAddress = COVERALLS_ADDRESS])
      : coverallsAddress = coverallsAddress is Uri
            ? coverallsAddress
            : Uri.parse(COVERALLS_ADDRESS);

  MultipartRequest _getCoverallsRequest(String json) {
    var req = new MultipartRequest("POST", coverallsAddress);
    req.files.add(
        new MultipartFile.fromString("json_file", json, filename: "json_file"));
    return req;
  }

  Future<CoverallsResult> sendToCoveralls(String json) async {
    var req = _getCoverallsRequest(json);
    log.info('Sending coverage information. JSON length: ${json.length}');
    var streamedResponse = await req.send();
    Response response = await Response.fromStream(streamedResponse);
    log.info('Coverage information sent.');

    var msg = response.body;

    if (response.statusCode != 200) {
      throw new Exception("${response.reasonPhrase}\n$msg");
    }
    log.info("200 OK");
    log.info("Response:\n$msg");

    var resultJson = JSON.decode(msg);
    return new CoverallsResult.fromJson(resultJson);
  }
}

Stop logging of HTML if status!=200

library dart_coveralls.coveralls_endpoint;

import 'dart:async' show Future;
import 'dart:convert' show JSON;

import 'package:http/http.dart' show MultipartRequest, MultipartFile, Response;

import 'coveralls_entities.dart';
import 'log.dart';

class CoverallsEndpoint {
  static const String COVERALLS_ADDRESS = "https://coveralls.io/api/v1/jobs";

  final Uri coverallsAddress;

  CoverallsEndpoint([coverallsAddress = COVERALLS_ADDRESS])
      : coverallsAddress = coverallsAddress is Uri
            ? coverallsAddress
            : Uri.parse(COVERALLS_ADDRESS);

  MultipartRequest _getCoverallsRequest(String json) {
    var req = new MultipartRequest("POST", coverallsAddress);
    req.files.add(
        new MultipartFile.fromString("json_file", json, filename: "json_file"));
    return req;
  }

  Future<CoverallsResult> sendToCoveralls(String json) async {
    var req = _getCoverallsRequest(json);
    log.info('Sending coverage information. JSON length: ${json.length}');
    var streamedResponse = await req.send();
    Response response = await Response.fromStream(streamedResponse);
    log.info('Coverage information sent.');

    var msg = response.body;

    if (response.statusCode != 200) {
      throw new Exception("${response.reasonPhrase}");
    }
    log.info("200 OK");
    log.info("Response:\n$msg");

    var resultJson = JSON.decode(msg);
    return new CoverallsResult.fromJson(resultJson);
  }
}


// Copyright (c) 2016, 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.
library kernel.target.flutter;

import 'targets.dart';
import 'vm.dart' show VmTarget;

class FlutterTarget extends VmTarget {
  FlutterTarget(TargetFlags flags) : super(flags);

  @override
  String get name => 'flutter';

  // This is the order that bootstrap libraries are loaded according to
  // `runtime/vm/object_store.h`.
  @override
  List<String> get extraRequiredLibraries => const <String>[
        'dart:async',
        'dart:collection',
        'dart:convert',
        'dart:developer',
        'dart:_internal',
        'dart:isolate',
        'dart:math',

        // The library dart:mirrors may be ignored by the VM, e.g. when built in
        // PRODUCT mode.
        'dart:mirrors',

        'dart:profiler',
        'dart:typed_data',
        'dart:nativewrappers',
        'dart:io',

        // Required for flutter.
        'dart:ui',
      ];
}

Add vmservice_sdk to target as it is needed in platform.dill to be included into app dill file for Flutter release gen_snapshot

// Copyright (c) 2016, 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.
library kernel.target.flutter;

import 'targets.dart';
import 'vm.dart' show VmTarget;

class FlutterTarget extends VmTarget {
  FlutterTarget(TargetFlags flags) : super(flags);

  @override
  String get name => 'flutter';

  // This is the order that bootstrap libraries are loaded according to
  // `runtime/vm/object_store.h`.
  @override
  List<String> get extraRequiredLibraries => const <String>[
        'dart:async',
        'dart:collection',
        'dart:convert',
        'dart:developer',
        'dart:_internal',
        'dart:isolate',
        'dart:math',

        // The library dart:mirrors may be ignored by the VM, e.g. when built in
        // PRODUCT mode.
        'dart:mirrors',

        'dart:profiler',
        'dart:typed_data',
        'dart:nativewrappers',
        'dart:io',

        // Required for flutter.
        'dart:ui',
        'dart:vmservice_sky',
      ];
}


library app_initializer;

import 'package:angular/angular.dart';
import 'package:di/di.dart';
import 'package:di/static_injector.dart';

// Generated Files!
import 'di_factories_gen.dart' as di_factories_gen;
import 'ng_parser_gen.dart' as ng_parser_gen;

createInjector(List<Module> modules) {
  di_factories_gen.main();
  return new StaticInjector(modules: modules,
      typeFactories: di_factories_gen.typeFactories);
}

createParser(Module module) {
  module.type(Parser, implementedBy: StaticParser);
  module.factory(StaticParserFunctions,
      (i) => ng_parser_gen.functions(i.get(FilterMap)));
}

Update to the latest StaticParser

library app_initializer;

import 'package:angular/angular.dart';
import 'package:di/di.dart';
import 'package:di/static_injector.dart';

// Generated Files!
import 'di_factories_gen.dart' as di_factories_gen;
import 'ng_parser_gen.dart' as ng_parser_gen;

createInjector(List<Module> modules) {
  di_factories_gen.main();
  return new StaticInjector(modules: modules,
      typeFactories: di_factories_gen.typeFactories);
}

createParser(Module module) {
  module.factory(Parser, (i) {
    StaticParserFunctions fns = ng_parser_gen.functions(i.get(FilterMap));
    return new StaticParser(fns, null);
  });
}


import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class CopyIntent extends Intent {
  const CopyIntent();
}

class SearchIntent extends Intent {
  const SearchIntent();
}

final globalShortcuts = {
  LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyC):
      const CopyIntent(),
  LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyF):
      const SearchIntent(),
};

Use CMD on Mac, Ctrl on rest.

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class CopyIntent extends Intent {
  const CopyIntent();
}

class SearchIntent extends Intent {
  const SearchIntent();
}

final ctrlOrCmd =
    Platform.isMacOS ? LogicalKeyboardKey.meta : LogicalKeyboardKey.control;

final globalShortcuts = {
  LogicalKeySet(ctrlOrCmd, LogicalKeyboardKey.keyC): const CopyIntent(),
  LogicalKeySet(ctrlOrCmd, LogicalKeyboardKey.keyF): const SearchIntent(),
};


// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

part of flutter_sprites;

class ImageMap {
  ImageMap(AssetBundle bundle) : _bundle = bundle;

  final AssetBundle _bundle;
  final Map<String, ui.Image> _images = new Map<String, ui.Image>();

  Future<List<ui.Image>> load(List<String> urls) {
    return Future.wait(urls.map(_loadImage));
  }

  Future<ui.Image> _loadImage(String url) async {
    ui.Image image = await _bundle.loadImage(url).first;
    _images[url] = image;
    return image;
  }

  ui.Image getImage(String url) => _images[url];
  ui.Image operator [](String url) => _images[url];
}

Update flutter_sprites now that ImageResource.first returns an ImageInfo

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

part of flutter_sprites;

class ImageMap {
  ImageMap(AssetBundle bundle) : _bundle = bundle;

  final AssetBundle _bundle;
  final Map<String, ui.Image> _images = new Map<String, ui.Image>();

  Future<List<ui.Image>> load(List<String> urls) {
    return Future.wait(urls.map(_loadImage));
  }

  Future<ui.Image> _loadImage(String url) async {
    ui.Image image = (await _bundle.loadImage(url).first).image;
    _images[url] = image;
    return image;
  }

  ui.Image getImage(String url) => _images[url];
  ui.Image operator [](String url) => _images[url];
}


// Copyright (c) 2014, 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.

library source_span.span_exception;

import 'span.dart';

/// A class for exceptions that have source span information attached.
class SourceSpanException implements Exception {
  /// A message describing the exception.
  final String message;

  /// The span associated with this exception.
  ///
  /// This may be `null` if the source location can't be determined.
  final SourceSpan span;

  SourceSpanException(this.message, this.span);

  /// Returns a string representation of [this].
  ///
  /// [color] may either be a [String], a [bool], or `null`. If it's a string,
  /// it indicates an ANSII terminal color escape that should be used to
  /// highlight the span's text. If it's `true`, it indicates that the text
  /// should be highlighted using the default color. If it's `false` or `null`,
  /// it indicates that the text shouldn't be highlighted.
  String toString({color}) {
    if (span == null) return message;
    return "Error on " + span.message(message, color: color);
  }
}

/// A [SourceSpanException] that's also a [FormatException].
class SourceSpanFormatException extends SourceSpanException
    implements FormatException {
  final source;

  int get position => span == null ? null : span.start.offset;

  SourceSpanFormatException(String message, SourceSpan span, [this.source])
      : super(message, span);
}

Change "FormatException.position" to be named "offset".

// Copyright (c) 2014, 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.

library source_span.span_exception;

import 'span.dart';

/// A class for exceptions that have source span information attached.
class SourceSpanException implements Exception {
  /// A message describing the exception.
  final String message;

  /// The span associated with this exception.
  ///
  /// This may be `null` if the source location can't be determined.
  final SourceSpan span;

  SourceSpanException(this.message, this.span);

  /// Returns a string representation of [this].
  ///
  /// [color] may either be a [String], a [bool], or `null`. If it's a string,
  /// it indicates an ANSII terminal color escape that should be used to
  /// highlight the span's text. If it's `true`, it indicates that the text
  /// should be highlighted using the default color. If it's `false` or `null`,
  /// it indicates that the text shouldn't be highlighted.
  String toString({color}) {
    if (span == null) return message;
    return "Error on " + span.message(message, color: color);
  }
}

/// A [SourceSpanException] that's also a [FormatException].
class SourceSpanFormatException extends SourceSpanException
    implements FormatException {
  final source;

  int get offset => span == null ? null : span.start.offset;

  SourceSpanFormatException(String message, SourceSpan span, [this.source])
      : super(message, span);
}


// Copyright 2015 The Chromium Authors. 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:sky/widgets/checkbox.dart';
import 'package:sky/widgets/toggleable.dart';
import 'package:sky/widgets/popup_menu.dart';
import 'package:sky/widgets/basic.dart';
import 'package:sky/framework/theme/view_configuration.dart';

class StockMenu extends Component {

  StockMenu({
    Object key,
    this.controller,
    this.autorefresh: false,
    this.onAutorefreshChanged
  }) : super(key: key);

  final PopupMenuController controller;
  final bool autorefresh;
  final ValueChanged onAutorefreshChanged;

  UINode build() {
    var checkbox = new Checkbox(
      value: this.autorefresh,
      onChanged: this.onAutorefreshChanged
    );

    return new StackPositionedChild(
      new PopupMenu(
        controller: controller,
        items: [
          [new Text('Add stock')],
          [new Text('Remove stock')],
          [new FlexExpandingChild(new Text('Autorefresh')), checkbox],
        ],
        level: 4
      ),
      right: 8.0,
      top: 8.0 + kStatusBarHeight
    );
  }
}

Remove unneeded import and fix analyzer warnings

// Copyright 2015 The Chromium Authors. 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:sky/widgets/checkbox.dart';
import 'package:sky/widgets/popup_menu.dart';
import 'package:sky/widgets/basic.dart';
import 'package:sky/framework/theme/view_configuration.dart';

class StockMenu extends Component {

  StockMenu({
    Object key,
    this.controller,
    this.autorefresh: false,
    this.onAutorefreshChanged
  }) : super(key: key);

  final PopupMenuController controller;
  final bool autorefresh;
  final ValueChanged onAutorefreshChanged;

  UINode build() {
    var checkbox = new Checkbox(
      value: this.autorefresh,
      onChanged: this.onAutorefreshChanged
    );

    return new StackPositionedChild(
      new PopupMenu(
        controller: controller,
        items: [
          [new Text('Add stock')],
          [new Text('Remove stock')],
          [new FlexExpandingChild(new Text('Autorefresh')), checkbox],
        ],
        level: 4
      ),
      right: 8.0,
      top: 8.0 + kStatusBarHeight
    );
  }
}


// Copyright (c) 2018, 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:expect/expect.dart';

void main() {
  print(const Symbol(null));                                //# 01: compile-time error
  print(const Symbol(r''));                                 //# 02: ok
  Expect.isTrue(identical(const Symbol(r'foo'), #foo));     //# 03: ok
  Expect.isTrue(identical(const Symbol(r'$foo'), #$foo));   //# 03: ok
  Expect.isTrue(identical(const Symbol(r'$_'), #$_));       //# 03: ok
  Expect.isTrue(identical(const Symbol(r'+'), #+));         //# 03: ok
  Expect.isTrue(identical(const Symbol(r'[]='), #[]=));     //# 03: ok
  Expect.isTrue(identical(const Symbol(r'_foo'), #_foo));   //# 03: compile-time error
  Expect.isTrue(identical(const Symbol(r'_$'), #_$));       //# 03: compile-time error
  Expect.isTrue(identical(const Symbol(r'_foo$'), #_foo$)); //# 03: compile-time error
  print(const Symbol(r'_+'));                               //# 03: compile-time error
}

Adjust vm test about the Symbol constructor

// Copyright (c) 2018, 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:expect/expect.dart';

void main() {
  print(const Symbol(null)); //# 01: compile-time error
  print(const Symbol(r''));
  Expect.isTrue(identical(const Symbol(r'foo'), #foo));
  Expect.isTrue(identical(const Symbol(r'$foo'), #$foo));
  Expect.isTrue(identical(const Symbol(r'$_'), #$_));
  Expect.isTrue(identical(const Symbol(r'+'), #+));
  Expect.isTrue(identical(const Symbol(r'[]='), #[]=));
  Expect.isFalse(identical(const Symbol(r'_foo'), #_foo));
  Expect.isFalse(identical(const Symbol(r'_$'), #_$));
  Expect.isFalse(identical(const Symbol(r'_foo$'), #_foo$));
  print(const Symbol(r'_+'));
}


// 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.

// Test that inlining in the compiler works with privacy.

import 'other_library.dart';

main() {
  Expect.equals(42, foo(new A()));
  Expect.throws(() => foo(new B()), (e) => e is NoSuchMethodError);
}

class B {
  _bar() => 42;
}

Add a library tag to allow running on DRT.

// 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.

// Test that inlining in the compiler works with privacy.

library private4_test;

import 'other_library.dart';

main() {
  Expect.equals(42, foo(new A()));
  Expect.throws(() => foo(new B()), (e) => e is NoSuchMethodError);
}

class B {
  _bar() => 42;
}


part of irc.parser;

/**
 * Base class for IRC Parsers
 *
 * ```
 * var parser = new SomeIrcParser();
 * var message = parser.convert(":some.server PRIVMSG #SomeChannel :Some Message");
 * // Use Message Instance
 * ```
 */
abstract class IrcParser extends Converter<String, Message> {

  /**
   * Creates the default IrcParser, which is [RegexIrcParser].
   */
  static IrcParser create() => new RegexIrcParser();

  /**
   * Parses [line] as an IRC line and outputs a [Message].
   */
  @override
  Message convert(String line);
}

Tweak Documentation to use spaces for the code highlighting

part of irc.parser;

/**
 * Base class for IRC Parsers
 *
 *      var parser = new SomeIrcParser();
 *      var message = parser.convert(":some.server PRIVMSG #SomeChannel :Some Message");
 *      // Use Message Instance
 */
abstract class IrcParser extends Converter<String, Message> {

  /**
   * Creates the default IrcParser, which is [RegexIrcParser].
   */
  static IrcParser create() => new RegexIrcParser();

  /**
   * Parses [line] as an IRC line and outputs a [Message].
   */
  @override
  Message convert(String line);
}


import 'package:meta/meta.dart';

import '../../../features/settings/presentation/bloc/settings_bloc.dart';
import 'connection_handler.dart';

abstract class GetUser {
  Future<Map<String, dynamic>> call({
    @required String tautulliId,
    @required int userId,
    @required SettingsBloc settingsBloc,
  });
}

class GetUserImpl implements GetUser {
  final ConnectionHandler connectionHandler;

  GetUserImpl({@required this.connectionHandler});

  @override
  Future<Map<String, dynamic>> call({
    @required String tautulliId,
    @required int userId,
    @required SettingsBloc settingsBloc,
  }) async {
    final responseJson = await connectionHandler(
      tautulliId: tautulliId,
      cmd: 'get_user',
      params: {
        'user_id': userId.toString(),
      },
      settingsBloc: settingsBloc,
    );

    return responseJson;
  }
}

Set include last seen to true for get user.

import 'package:meta/meta.dart';

import '../../../features/settings/presentation/bloc/settings_bloc.dart';
import 'connection_handler.dart';

abstract class GetUser {
  Future<Map<String, dynamic>> call({
    @required String tautulliId,
    @required int userId,
    @required SettingsBloc settingsBloc,
  });
}

class GetUserImpl implements GetUser {
  final ConnectionHandler connectionHandler;

  GetUserImpl({@required this.connectionHandler});

  @override
  Future<Map<String, dynamic>> call({
    @required String tautulliId,
    @required int userId,
    @required SettingsBloc settingsBloc,
  }) async {
    final responseJson = await connectionHandler(
      tautulliId: tautulliId,
      cmd: 'get_user',
      params: {
        'user_id': userId.toString(),
        'include_last_seen': 'true',
      },
      settingsBloc: settingsBloc,
    );

    return responseJson;
  }
}


part of irc.bot;

/**
 * Base Class for Bots
 */
abstract class Bot {
  Client client();

  void connect() => client().connect();

  void disconnect() => client().disconnect();

  Channel channel(String name) => client().channel(name);

  void register(handler) => client().register(handler);

  void join(String channel) => client().join(channel);

  void part(String channel) => client().part(channel);

  void message(String target, String message) => client().message(target, message);
}

Fix Return Type for Bot.register(handler)

part of irc.bot;

/**
 * Base Class for Bots
 */
abstract class Bot {
  Client client();

  void connect() => client().connect();

  void disconnect() => client().disconnect();

  Channel channel(String name) => client().channel(name);

  bool register(handler) => client().register(handler);

  void join(String channel) => client().join(channel);

  void part(String channel) => client().part(channel);

  void message(String target, String message) => client().message(target, message);
}


// 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.

library barback.transform_logger;

import 'package:source_maps/span.dart';

/// Object used to report warnings and errors encountered while running a
/// transformer.
class TransformLogger {

  bool _shouldPrint;

  TransformLogger(this._shouldPrint);

  /// Logs a warning message.
  ///
  /// If present, [span] indicates the location in the input asset that caused
  /// the warning.
  void warning(String message, [Span span]) {
    _printMessage('warning', message, span);
  }

  /// Logs an error message.
  ///
  /// If present, [span] indicates the location in the input asset that caused
  /// the error.
  // TODO(sigmund,nweiz): clarify when an error should be logged or thrown.
  void error(String message, [Span span]) {
    _printMessage('error', message, span);
  }

  // TODO(sigmund,rnystrom): do something better than printing.
  _printMessage(String prefix, String message, Span span) {
    if (!_shouldPrint) return;
    print(span == null ? '$prefix $message'
        : '$prefix ${span.getLocationMessage(message)}');
  }
}

Support dart2js in pub serve.

// 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.

library barback.transform_logger;

import 'package:source_maps/span.dart';

/// Object used to report warnings and errors encountered while running a
/// transformer.
class TransformLogger {

  bool _shouldPrint;

  TransformLogger(this._shouldPrint);

  /// Logs an informative message.
  ///
  /// If present, [span] indicates the location in the input asset that caused
  /// the message.
  void info(String message, [Span span]) {
    _printMessage('info', message, span);
  }

  /// Logs a warning message.
  ///
  /// If present, [span] indicates the location in the input asset that caused
  /// the warning.
  void warning(String message, [Span span]) {
    _printMessage('warning', message, span);
  }

  /// Logs an error message.
  ///
  /// If present, [span] indicates the location in the input asset that caused
  /// the error.
  // TODO(sigmund,nweiz): clarify when an error should be logged or thrown.
  void error(String message, [Span span]) {
    _printMessage('error', message, span);
  }

  // TODO(sigmund,rnystrom): do something better than printing.
  _printMessage(String prefix, String message, Span span) {
    if (!_shouldPrint) return;
    print(span == null ? '$prefix $message'
        : '$prefix ${span.getLocationMessage(message)}');
  }
}


import 'dart:io';

class IpAddressHelper {
  /// Returns true if IP address is not a loopback, link local, or private IP
  ///
  /// Throws a generic exception if [ipAddress] cannot be parsed
  static bool isPublic(String ipAddress) {
    final parsedAddress = InternetAddress.tryParse(ipAddress);

    if (parsedAddress == null) {
      throw Exception();
    }

    if (parsedAddress.isLinkLocal || parsedAddress.isLoopback) {
      return false;
    }

    if (parsedAddress.type == InternetAddressType.IPv4) {
      List<int> octets =
          parsedAddress.address.split('.').map((e) => int.parse(e)).toList();

      if ((octets[0] == 10) ||
          (octets[0] == 172 && octets[1] >= 16 && octets[1] <= 31) ||
          (octets[0] == 192 && octets[1] == 168)) {
        return false;
      }
    }

    if (parsedAddress.type == InternetAddressType.IPv6) {
      if (parsedAddress.address.startsWith('fe80')) {
        return false;
      }
    }

    return true;
  }
}

Add helper function to parse IP from URL string.

import 'dart:io';

class IpAddressHelper {
  /// Returns true if IP address is not a loopback, link local, or private IP
  ///
  /// Throws a generic exception if [ipAddress] cannot be parsed
  static bool isPublic(String ipAddress) {
    final parsedAddress = InternetAddress.tryParse(ipAddress);

    if (parsedAddress == null) {
      throw Exception();
    }

    if (parsedAddress.isLinkLocal || parsedAddress.isLoopback) {
      return false;
    }

    if (parsedAddress.type == InternetAddressType.IPv4) {
      List<int> octets =
          parsedAddress.address.split('.').map((e) => int.parse(e)).toList();

      if ((octets[0] == 10) ||
          (octets[0] == 172 && octets[1] >= 16 && octets[1] <= 31) ||
          (octets[0] == 192 && octets[1] == 168)) {
        return false;
      }
    }

    if (parsedAddress.type == InternetAddressType.IPv6) {
      if (parsedAddress.address.startsWith('fe80')) {
        return false;
      }
    }

    return true;
  }

  static String parseIpFromUrl(String url) {
    String parsedIp = '';

    RegExp ipv4Exp = RegExp(r"http[s]?:\/\/([0-9,.]+)[\S]*");
    RegExp ipv6Exp = RegExp(r"http[s]?:\/\/([[a-f,0-9,:]+])[\S]*");

    if (ipv4Exp.hasMatch(url)) {
      Iterable<Match> ipv4Matches = ipv4Exp.allMatches(url);
      ipv4Matches.forEach((m) {
        parsedIp = m.group(1);
      });
    } else if (ipv6Exp.hasMatch(url)) {
      Iterable<Match> ipv6Matches = ipv6Exp.allMatches(url);
      ipv6Matches.forEach((m) {
        parsedIp = m.group(1);
      });
    }

    return parsedIp;
  }
}


// Copyright (c) 2017, 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.
//
// Test that type tests are not misoptimized.
// VMOptions=--optimization-counter-threshold=1000 --optimization-filter=IsAnInt

main() {
  train();
  if (IsAnInt("This is not an int")) throw "oops";
}

// Prime the IC with things that are and are not ints.
void train() {
  int sum = 0;
  for (int i = 0; i < 10000; i++) {
    IsAnInt(42); // Smi - always goes first in the generated code.
    IsAnInt(1 << 62); // Mint on 64 bit platforms.
    IsAnInt(1 << 62);
    IsAnInt(4200000000000000000000000000000000000); // BigInt
    IsAnInt(4200000000000000000000000000000000000);
    // This one that is not an int goes last in the IC because it is called
    // less frequently.
    IsAnInt(4.2);
  }
}

int IsAnInt(Foo f) => f is int;

Fix new test in checked mode

// Copyright (c) 2017, 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.
//
// Test that type tests are not misoptimized.
// VMOptions=--optimization-counter-threshold=1000 --optimization-filter=IsAnInt

main() {
  train();
  if (IsAnInt("This is not an int")) throw "oops";
}

// Prime the IC with things that are and are not ints.
void train() {
  for (int i = 0; i < 10000; i++) {
    IsAnInt(42); // Smi - always goes first in the generated code.
    IsAnInt(1 << 62); // Mint on 64 bit platforms.
    IsAnInt(1 << 62);
    IsAnInt(4200000000000000000000000000000000000); // BigInt
    IsAnInt(4200000000000000000000000000000000000);
    // This one that is not an int goes last in the IC because it is called
    // less frequently.
    IsAnInt(4.2);
  }
}

bool IsAnInt(f) => f is int;


// Copyright (c) 2012, 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.

// Dart test program for testing that exceptions in other isolates bring down
// the program.

#library('Isolate2NegativeTest');
#import('dart:isolate');
#import('../../lib/unittest/unittest.dart');

void entry() {
  throw "foo";
}

main() {
  test("catch exception from other isolate", () {
    spawnFunction(entry);
  });
}

Fix negative test by not complicating it by using the unit test framework.

// Copyright (c) 2012, 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.

// Dart test program for testing that exceptions in other isolates bring down
// the program.

#library('Isolate2NegativeTest');
#import('dart:isolate');

void entry() {
  throw "foo";
}

main() {
  SendPort port = spawnFunction(entry);
}


library webdriver_test.window;

import 'package:unittest/unittest.dart';
import 'package:webdriver/webdriver.dart';

void main() {
  group('Window', () {
    WebDriver driver;

    setUp(() async {
      driver = await WebDriver.createDriver(
          desiredCapabilities: Capabilities.chrome);
    });

    tearDown(() => driver.quit());

    test('size', () async {
      var window = await driver.window;
      var size = const Size(400, 600);
      await window.setSize(size);
      expect(await window.size, size);
    });

    test('location', () async {
      var window = await driver.window;
      var position = const Point(100, 200);
      await window.setLocation(position);
      expect(await window.location, position);
    });

    test('maximize', () async {
      var window = await driver.window;
      await window.setSize(const Size(200, 300));
      await window.setLocation(const Point(100, 200));
      await window.maximize();
      var location = await window.location;
      var size = await window.size;
      expect(location.x, lessThan(100));
      expect(location.y, lessThan(200));
      expect(size.height, greaterThan(200));
      expect(size.width, greaterThan(300));
    });
  });
}

Add comment to maximize test to warn that it may fail in some cases.

library webdriver_test.window;

import 'package:unittest/unittest.dart';
import 'package:webdriver/webdriver.dart';

void main() {
  group('Window', () {
    WebDriver driver;

    setUp(() async {
      driver = await WebDriver.createDriver(
          desiredCapabilities: Capabilities.chrome);
    });

    tearDown(() => driver.quit());

    test('size', () async {
      var window = await driver.window;
      var size = const Size(400, 600);
      await window.setSize(size);
      expect(await window.size, size);
    });

    test('location', () async {
      var window = await driver.window;
      var position = const Point(100, 200);
      await window.setLocation(position);
      expect(await window.location, position);
    });

    // May not work on some OS/browser combinations (notably Mac OS X).
    test('maximize', () async {
      var window = await driver.window;
      await window.setSize(const Size(200, 300));
      await window.setLocation(const Point(100, 200));
      await window.maximize();
      var location = await window.location;
      var size = await window.size;
      expect(location.x, lessThan(100));
      expect(location.y, lessThan(200));
      expect(size.height, greaterThan(200));
      expect(size.width, greaterThan(300));
    });
  });
}


library distributed_dart;
import 'dart:io';
import 'dart:async';
import 'dart:isolate';
import 'dart:json';
import 'dart:typeddata';

part 'src/dart_import/util/characters.dart';
//part 'src/dart_import/dart_code.dart';
part 'src/dart_import/scanner.dart';

part 'src/network/network.dart';

// logging mechanism instad of print

/**
 * Set to true for enabling debug output from the distributed_dart library.
 * Default value is false.
 */
bool logging = false;

_log(var msg) => logging ? stdout.writeln("DIST_DART, log: ${msg}") : "";
_err(var msg) => logging ? stderr.writeln("DIST_DART, err: ${msg}") : "";

Fix error. import dart:json as json.

library distributed_dart;
import 'dart:io';
import 'dart:async';
import 'dart:isolate';
import 'dart:json' as json;
import 'dart:typeddata';

part 'src/dart_import/util/characters.dart';
//part 'src/dart_import/dart_code.dart';
part 'src/dart_import/scanner.dart';

part 'src/network/network.dart';

// logging mechanism instad of print

/**
 * Set to true for enabling debug output from the distributed_dart library.
 * Default value is false.
 */
bool logging = false;

_log(var msg) => logging ? stdout.writeln("DIST_DART, log: ${msg}") : "";
_err(var msg) => logging ? stderr.writeln("DIST_DART, err: ${msg}") : "";


import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class Map extends StatelessWidget {
  GoogleMapController mapController;
  final LatLng _center = const LatLng(45.521563, -122.677433);
  void _onMapCreated(GoogleMapController controller) {
    mapController = controller;
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: GoogleMap(
        onMapCreated: _onMapCreated,
        initialCameraPosition: CameraPosition(
          target: _center,
          zoom: 11.0,
        ),
      ),
    );
  }
}

Set default coordinates to ucsd

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class Map extends StatelessWidget {
  GoogleMapController mapController;
  final LatLng _center = const LatLng(32.8801,-117.2340);
  void _onMapCreated(GoogleMapController controller) {
    mapController = controller;
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: GoogleMap(
        onMapCreated: _onMapCreated,
        initialCameraPosition: CameraPosition(
          target: _center,
          zoom: 11.0,
        ),
      ),
    );
  }
}


library debiki_admin;

import 'package:angular/angular.dart';
import 'package:perf_api/perf_api.dart';

import 'package:debiki_admin/debiki_admin_controller.dart';
import 'package:debiki_admin/component/view_topics_component.dart';
import 'package:debiki_admin/component/view_comments_component.dart';
import 'package:debiki_admin/routing/debiki_admin_router.dart';
import 'package:debiki_admin/service/query_service.dart';

// Temporary, please follow https://github.com/angular/angular.dart/issues/476
@MirrorsUsed(targets: const['debiki_admin'], override: '*')
import 'dart:mirrors';

class DebikiAdminModule extends Module {
  DebikiAdminModule() {
    type(DebikiAdminController);
    type(DebikiAdminQueryService);
    type(ViewTopicsComponent);
    type(ViewCommentsComponent);
    type(RouteInitializer, implementedBy: DebikiAdminRouteInitializer);
    factory(NgRoutingUsePushState, (_) => new NgRoutingUsePushState.value(false));
    type(Profiler, implementedBy: Profiler); // comment out to enable profiling
  }
}

main() {
  ngBootstrap(module: new DebikiAdminModule());
}

Remove @MirrorUsed, it breaks Javascript in Firefox

library debiki_admin;

import 'package:angular/angular.dart';
import 'package:perf_api/perf_api.dart';

import 'package:debiki_admin/debiki_admin_controller.dart';
import 'package:debiki_admin/component/view_topics_component.dart';
import 'package:debiki_admin/component/view_comments_component.dart';
import 'package:debiki_admin/routing/debiki_admin_router.dart';
import 'package:debiki_admin/service/query_service.dart';

// Temporary, please follow https://github.com/angular/angular.dart/issues/476
/* @MirrorsUsed(
    targets: const[
      'debiki_admin',
      'debiki_admin_controller',
      'view_topics_component',
      'view_comments_component'],
    override: '*') */
//import 'dart:mirrors';

class DebikiAdminModule extends Module {
  DebikiAdminModule() {
    type(DebikiAdminController);
    type(DebikiAdminQueryService);
    type(ViewTopicsComponent);
    type(ViewCommentsComponent);
    type(RouteInitializer, implementedBy: DebikiAdminRouteInitializer);
    factory(NgRoutingUsePushState, (_) => new NgRoutingUsePushState.value(false));
    type(Profiler, implementedBy: Profiler); // comment out to enable profiling
  }
}

main() {
  ngBootstrap(module: new DebikiAdminModule());
}


// Copyright (c) 2022, 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.

// @dart=2.16

// ignore_for_file: unused_local_variable

import 'dart:ffi';

class MyFinalizable implements Finalizable {
  int _internalValue = 4;

  int Function() capturingThis() {
    return () {
      final result = this._internalValue;
      // Should generate: _reachabilityFence(this)
      return result;
    };
    // Should generate: _reachabilityFence(this)
  }

  int Function() capturingThis2() {
    return () {
      return this._internalValue;
      // Should generate: _reachabilityFence(this)
    };
    // Should generate: _reachabilityFence(this)
  }

  int Function() capturingThis3() {
    return () {
      return _internalValue;
      // Should generate: _reachabilityFence(this)
    };
    // Should generate: _reachabilityFence(this)
  }

  /// Tests that captures later in the body also cause fences earlier in the body.
  int Function() capturingThis4() {
    return () {
      if (DateTime.now().millisecondsSinceEpoch == 42) {
        // Should generate: _reachabilityFence(this)
        return 3;
      }
      return _internalValue;
      // Should generate: _reachabilityFence(this)
    };
    // Should generate: _reachabilityFence(this)
  }
}

void main() {}

Remove an unneeded ignore comment in vm package

// Copyright (c) 2022, 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.

// @dart=2.16

import 'dart:ffi';

class MyFinalizable implements Finalizable {
  int _internalValue = 4;

  int Function() capturingThis() {
    return () {
      final result = this._internalValue;
      // Should generate: _reachabilityFence(this)
      return result;
    };
    // Should generate: _reachabilityFence(this)
  }

  int Function() capturingThis2() {
    return () {
      return this._internalValue;
      // Should generate: _reachabilityFence(this)
    };
    // Should generate: _reachabilityFence(this)
  }

  int Function() capturingThis3() {
    return () {
      return _internalValue;
      // Should generate: _reachabilityFence(this)
    };
    // Should generate: _reachabilityFence(this)
  }

  /// Tests that captures later in the body also cause fences earlier in the body.
  int Function() capturingThis4() {
    return () {
      if (DateTime.now().millisecondsSinceEpoch == 42) {
        // Should generate: _reachabilityFence(this)
        return 3;
      }
      return _internalValue;
      // Should generate: _reachabilityFence(this)
    };
    // Should generate: _reachabilityFence(this)
  }
}

void main() {}


import 'package:pwa/worker.dart';
import 'package:website/pwa/offline_urls.g.dart' as offline;

/// The Progressive Web Application's entry point.
void main() {
  // The Worker handles the low-level code for initialization, fetch API
  // routing and (later) messaging.
  Worker worker = new Worker();

  // The static assets that need to be in the cache for offline mode.
  // By default it uses the automatically generated list from the output of
  // `pub build`. To refresh this list, run `pub run pwa` after each new build.
  worker.offlineUrls = offline.offlineUrls;

  // The above list can be extended with additional URLs:
  //
  // List<String> offlineUrls = new List.from(offline.offlineUrls);
  // offlineUrls.addAll(['https://www.example.org/custom/resource/']);
  // worker.offlineUrls = offlineUrls;

  // Fine-tune the caching and network fetch with dynamic caches and cache
  // strategies on the url-prefixed network routes:
  //
  // DynamicCache cache = new DynamicCache('images');
  // worker.router.registerGetUrl('https://cdn.example.com/', cache.networkFirst);

  // Start the worker.
  worker.run(version: offline.lastModified);
}

Use cascading methods off of first Worker() reference

import 'package:pwa/worker.dart';
import 'package:website/pwa/offline_urls.g.dart' as offline;

/// The Progressive Web Application's entry point.
void main() {
  // The Worker handles the low-level code for initialization, fetch API
  // routing and (later) messaging.
  new Worker()

    // The static assets that need to be in the cache for offline mode.
    // By default it uses the automatically generated list from the output of
    // `pub build`. To refresh this list, run `pub run pwa` after each new build.
    ..offlineUrls = offline.offlineUrls

    // The above list can be extended with additional URLs:
    //
    // List<String> offlineUrls = new List.from(offline.offlineUrls);
    // offlineUrls.addAll(['https://www.example.org/custom/resource/']);
    // worker.offlineUrls = offlineUrls;

    // Fine-tune the caching and network fetch with dynamic caches and cache
    // strategies on the url-prefixed network routes:
    //
    // DynamicCache cache = new DynamicCache('images');
    // worker.router.registerGetUrl('https://cdn.example.com/', cache.networkFirst);

    // Start the worker.
    ..run(version: offline.lastModified);
}


// Copyright (c) 2016, 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.md file.

library fasta.scanner.main;

import 'io.dart' show readBytesFromFileSync;

import '../scanner.dart' show scan;

scanAll(Map<Uri, List<int>> files) {
  Stopwatch sw = new Stopwatch()..start();
  int byteCount = 0;
  files.forEach((Uri uri, List<int> bytes) {
    scan(bytes);
    byteCount += bytes.length - 1;
  });
  sw.stop();
  print("Scanning files took: ${sw.elapsed}");
  print("Bytes/ms: ${byteCount/sw.elapsedMilliseconds}");
}

mainEntryPoint(List<String> arguments) {
  Map<Uri, List<int>> files = <Uri, List<int>>{};
  Stopwatch sw = new Stopwatch()..start();
  for (String name in arguments) {
    Uri uri = Uri.base.resolve(name);
    List<int> bytes = readBytesFromFileSync(uri);
    files[uri] = bytes;
  }
  sw.stop();
  print("Reading files took: ${sw.elapsed}");
  scanAll(files);
}

Add option for printing tokens produced by the scanner.

// Copyright (c) 2016, 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.md file.

library fasta.scanner.main;

import 'io.dart' show readBytesFromFileSync;

import '../scanner.dart' show scan;

scanAll(Map<Uri, List<int>> files) {
  Stopwatch sw = new Stopwatch()..start();
  int byteCount = 0;
  files.forEach((Uri uri, List<int> bytes) {
    var token = scan(bytes).tokens;
    if (const bool.fromEnvironment("printTokens")) {
      while (!token.isEof) {
        print("${token.charOffset}: ${token}");
        token = token.next;
      }
    }
    byteCount += bytes.length - 1;
  });
  sw.stop();
  print("Scanning files took: ${sw.elapsed}");
  print("Bytes/ms: ${byteCount/sw.elapsedMilliseconds}");
}

mainEntryPoint(List<String> arguments) {
  Map<Uri, List<int>> files = <Uri, List<int>>{};
  Stopwatch sw = new Stopwatch()..start();
  for (String name in arguments) {
    Uri uri = Uri.base.resolve(name);
    List<int> bytes = readBytesFromFileSync(uri);
    files[uri] = bytes;
  }
  sw.stop();
  print("Reading files took: ${sw.elapsed}");
  scanAll(files);
}


import '../../ordering.dart';

class NullsLastOrdering<T> extends Ordering<T> {
  final Ordering<T> ordering;

  const NullsLastOrdering(this.ordering);

  @override
  int compare(T a, T b) {
    if (a == null && b == null) {
      return 0;
    } else if (a == null) {
      return 1;
    } else if (identical(b, null)) {
      return -1;
    }
    return ordering.compare(a, b);
  }

  @override
  Ordering<T> get reversed => ordering.reversed.nullsFirst;

  @override
  Ordering<T> get nullsFirst => ordering.nullsFirst;

  @override
  Ordering<T> get nullsLast => this;
}

Fix another issue from the cherry-picking.

import '../../ordering.dart';

class NullsLastOrdering<T> extends Ordering<T> {
  final Ordering<T> ordering;

  const NullsLastOrdering(this.ordering);

  @override
  int compare(T a, T b) {
    if (a == null && b == null) {
      return 0;
    } else if (a == null) {
      return 1;
    } else if (b == null) {
      return -1;
    }
    return ordering.compare(a, b);
  }

  @override
  Ordering<T> get reversed => ordering.reversed.nullsFirst;

  @override
  Ordering<T> get nullsFirst => ordering.nullsFirst;

  @override
  Ordering<T> get nullsLast => this;
}


part of plugins.common;

class RequestManager {

  Map<int, Completer> _requests = {};
  final Random _rand = new Random();

  void complete(int uid, String command, Map<dynamic, dynamic> data) {
    var com = _requests[uid];
    if (com == null)
      throw new Exception("Attempt to complete an invalid request");
    com.complete(data);
  }

  int queue(Completer completer) {
    int uid = _rand.nextInt(10000);
    while (_requests.containsKey(uid))
      uid = _rand.nextInt(10000);
    _requests[uid] = completer;
    return uid;
  }
}

/**
 * Handles data for requests. Replies are expected to ensure the request
 * is completed.
 */
class Request {

  final SendPort _sp;

  /**
   * THe name of the command.
   */
  final String command;

  /**
   * Identifier for the request that will be expected by the requester.
   */
  final int uid;

  /**
   * The received [data] from the plugin or the loader.
   */
  final Map<dynamic, dynamic> data;

  Request(this._sp, this.uid, this.command, this.data);

  /**
   * Replies are expected to ensure data is sent back.
   */
  void reply(Map<dynamic, dynamic> info) {
    var wrapped = <String, dynamic>{
      'type': SendType.NORMAL,
      'uid': uid,
      'command': command,
      'data': info
    };
    _sp.send(wrapped);
  }
}

Remove the completer from the list

part of plugins.common;

class RequestManager {

  Map<int, Completer> _requests = {};
  final Random _rand = new Random();

  void complete(int uid, String command, Map<dynamic, dynamic> data) {
    var com = _requests[uid];
    if (com == null)
      throw new Exception("Attempt to complete an invalid request");
    com.complete(data);
    _requests.remove(uid);
  }

  int queue(Completer completer) {
    int uid = _rand.nextInt(10000);
    while (_requests.containsKey(uid))
      uid = _rand.nextInt(10000);
    _requests[uid] = completer;
    return uid;
  }
}

/**
 * Handles data for requests. Replies are expected to ensure the request
 * is completed.
 */
class Request {

  final SendPort _sp;

  /**
   * THe name of the command.
   */
  final String command;

  /**
   * Identifier for the request that will be expected by the requester.
   */
  final int uid;

  /**
   * The received [data] from the plugin or the loader.
   */
  final Map<dynamic, dynamic> data;

  Request(this._sp, this.uid, this.command, this.data);

  /**
   * Replies are expected to ensure data is sent back.
   */
  void reply(Map<dynamic, dynamic> info) {
    var wrapped = <String, dynamic>{
      'type': SendType.NORMAL,
      'uid': uid,
      'command': command,
      'data': info
    };
    _sp.send(wrapped);
  }
}