This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'; | |
import 'dart:async'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
/// Produces the following output (since [futureOrResult] value is available synchronously): | |
/// ``` | |
/// process: 0 | |
/// result: 0 | |
/// process: 1 | |
/// ``` | |
Future<void> main() async { | |
unawaited(process()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
print(DateTime.now()); | |
print(DateTime.now().toUtc()); | |
print(DateTime.now().difference(DateTime.now().toUtc())); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
void main() { | |
fn1(); | |
scheduleMicrotask(() { | |
print('microtask after fn1'); | |
}); | |
fn2(); | |
scheduleMicrotask(() { | |
print('microtask after fn2'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final di = DIContainer(); | |
final quarterExpenses1 = di.getComputeQuarterExpensesUseCase().perform(100000); | |
print(quarterExpenses1); | |
final quarterExpenses2 = di.getComputeQuarterExpensesUseCaseFunction()(100000); | |
print(quarterExpenses2); | |
final quarterExpenses3 = di.getExplicitComputeQuarterExpensesUseCaseFunction()(100000); | |
print(quarterExpenses3); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> main() async { | |
await test(); | |
} | |
Future<void> test() async { | |
try { | |
return await errorGenerator(); | |
} catch (e) { | |
print('!!!CAPTURED ERROR!!!'); | |
} finally { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> main() async { | |
await test(); | |
} | |
Future<void> test() async { | |
try { | |
return errorGenerator(); | |
} catch (e) { | |
print('!!!CAPTURED ERROR!!!'); | |
} finally { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
const lineHeight = 27.0; | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef EnumMapperCallback<T, E> = T Function(E value); | |
class EnumMapper<E, T> { | |
EnumMapper(List<E> enumValues, EnumMapperCallback<T, E> mapper) { | |
for (final enumValue in enumValues) { | |
final key = enumValue; | |
final value = mapper(enumValue); | |
_forwardMap[key] = value; | |
_inverseMap[value] = key; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BitmapDescriptor _stationPin; | |
ui.Image _clusterBgImage; | |
Future<BitmapDescriptor> _getClusterBitmap( | |
BuildContext context, | |
MapCluster cluster, | |
) async { | |
if (!cluster.isCluster && _stationPin != null) { | |
return _stationPin; | |
} |
NewerOlder