Install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Then install ant using brew
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
/// Written by PHNTM GmbH | |
void main() { | |
runApp(const AdvancedOverlaySample()); | |
} |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(Kata()); | |
} | |
class Kata extends StatelessWidget { | |
@override |
import 'dart:async'; | |
void main() async { | |
// start future | |
final future = doHardWork(); | |
// continously post progress | |
final sub = showProgress().listen((_) {}); | |
// wait for completion | |
await future; | |
// stop progress |
// @dart=2.12 | |
/// A const implementation of Uri which crashes at first access in case the uri is invalid | |
class ConstUri implements Uri { | |
/// Caches the static parsed uri | |
/// | |
/// The parsed uri can't be a mutable member field because that's not allowed for const classes | |
static final _cache = <String, Uri>{}; | |
const ConstUri(String uri) : _uri = uri; |
import 'package:flutter/material.dart'; | |
Future<void> main() async { | |
runApp(Builder( | |
builder: (context) => const MyApp(), | |
)); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({ |
void main() { | |
final Object something = TypeA(); | |
something.matchTypes({ | |
TypeA : () => print("found A"), | |
TypeB : () => print("found B"), | |
}); | |
} |
#!/bin/sh | |
# Usage: ./tool/run_coverage.sh test/all_tests.dart | |
(pub global list | grep coverage) || { | |
# install coverage when not found | |
pub global activate coverage | |
} | |
pub global run coverage:collect_coverage \ |
void main() { | |
final String name = "Adam"; | |
print("=== ?? ==="); | |
// does not execute defaultValue() | |
print(name ?? defaultValue()); | |
print("=== orDefault ==="); | |
// executes defaultValue() | |
print(name.orDefault(defaultValue())); |