Install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Then install ant using brew
| import 'package:flutter_test/flutter_test.dart'; | |
| void main() { | |
| test('1 should round 0.145 to 0.15', () { | |
| const value = 0.145; | |
| final rounded = value.toStringAsFixed(2); | |
| expect(rounded, '0.15'); // actual 0.14 | |
| }); | |
| test('2 should round 0.145 to 0.15', () { |
| 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 \ |