This file contains hidden or 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
| abstract class TimeProvider { | |
| Future<void> delayed(Duration duration); | |
| } | |
| class TimeProviderImpl implements TimeProvider { | |
| @override | |
| Future<void> delayed(Duration duration) => Future<void>.delayed(duration); | |
| } | |
| class MockTimeProvider implements TimeProvider { |
This file contains hidden or 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
| testWidgets('time test', (tester) async { | |
| const done = Key('done'); | |
| const pending = Key('pending'); | |
| await tester.pumpWidget( | |
| FutureBuilder( | |
| future: Future<void>.delayed(const Duration(seconds: 10)), | |
| builder: (context, sn) { | |
| return sn.connectionState == ConnectionState.done | |
| ? const SizedBox(key: done) | |
| : const SizedBox(key: pending); |
This file contains hidden or 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:math' as math; | |
| import 'package:flutter/rendering.dart'; | |
| import 'package:flutter/widgets.dart'; | |
| class SliverFloatingHeader extends SingleChildRenderObjectWidget { | |
| const SliverFloatingHeader({ | |
| Key key, | |
| Widget child, | |
| }) : super(key: key, child: child); |
This file contains hidden or 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 PublishSubject<Configuration> configStream = PublishSubject(); | |
| enableFlutterDriverExtension( | |
| handler: (request) async { | |
| final Configuration config = Configuration.fromJson(json.decode(request)); | |
| configStream.add(config); | |
| return null; | |
| }, | |
| ); | |
| runApp( |
This file contains hidden or 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
| - `flutter channel master && flutter doctor` | |
| - `export ENABLE_FLUTTER_DESKTOP=true` | |
| - `git clone [email protected]:google/flutter-desktop-embedding.git` | |
| - Move your project inside the `flutter-desktop-embedding` folder | |
| - Copy the `macos` folder from `flutter-desktop-embedding/example` to your project | |
| - `cd flutter-desktop-embedding/my-project && flutter run -d macos` |
This file contains hidden or 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'; | |
| import 'package:flutter/widgets.dart'; | |
| class AnimationPerformance extends StatefulWidget { | |
| @override | |
| _BadTranslate createState() => _BadTranslate(); | |
| } | |
| class _BadTranslate extends State<AnimationPerformance> | |
| with SingleTickerProviderStateMixin { |
This file contains hidden or 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() { | |
| // Displays build timeline | |
| debugProfileBuildsEnabled = true; | |
| runApp(GlobalKeyWidget()); | |
| } | |
| class WidgetsWithKeysAreJustUpdated extends StatefulWidget { |
This file contains hidden or 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'; | |
| import 'package:flutter_test/flutter_test.dart'; | |
| void main() { | |
| setUp(() { | |
| // Limits viewport in tests to size of 100, 100 to decrease the size of | |
| // the pngs | |
| WidgetsBinding.instance.renderView.configuration = | |
| TestViewConfiguration(size: const Size(100, 100)); | |
| }); |
This file contains hidden or 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
| # Check https://dart-lang.github.io/linter/lints/ for lint rules documentation | |
| # Update from http://dart-lang.github.io/linter/lints/options/options.html | |
| analyzer: | |
| errors: | |
| missing_required_param: error | |
| missing_return: error | |
| todo: ignore | |
| language: | |
| strict-inference: true |
This file contains hidden or 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
| class OnErrorResumeNextStreamTransformer2<T> | |
| extends StreamTransformerBase<T, T> { | |
| final StreamTransformer<T, T> transformer; | |
| // From the orginal version parameter was changed from `Stream<T> recoveryStream` to `Stream<T> Function (dynamic error) recoveryStream` | |
| OnErrorResumeNextStreamTransformer2(Stream<T> Function (dynamic error) recoveryStream) | |
| : transformer = _buildTransformer(recoveryStream); | |
| @override | |
| Stream<T> bind(Stream<T> stream) => transformer.bind(stream); |