Skip to content

Instantly share code, notes, and snippets.

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
final questions = [
typedef T2 Adder<T1, T2>(T1 left, T1 right);
class AddMachine<A> {
A left;
A right;
AddMachine(this.left, this.right);
B Sum<B>(Adder<A, B> adder) {
print([A, B]);
typedef T2 Foo2<T1, T2>(T1);
typedef T3 Foo3<T1, T2, T3>(T1, T2);
class Bar<A> {
final List<A> outer;
Bar(this.outer);
void run<B, C, D>(
List<B> inner,
Foo2<A, C> outerSelector,
// Widget class
@override initState() {
AppStateBloc.stream.listen(updateWidget); // Subscribe to the state stream
}
void updateWidget(AppState obj) {
setState(() {}); // Trigger rebuild
}