blob: 1bec7f929edb7f0eb75f7dda1ae7508e50d6f23c [file] [log] [blame]
// Copyright 2014 The Flutter Authors. 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/widgets.dart';
// Test file used by `create_test.dart` to verify that `flutter create` sets up
// `analysis_options.yaml` correctly to activate certain lints and ensures
// that lints not playing well with Flutter remain disabled.
class NoConstructor extends StatelessWidget {
// LINT: Missing constructor generates use_key_in_widget_constructors warning.
@override
Widget build(BuildContext context) => Container();
}
class NoConstConstructor extends StatelessWidget {
// LINT: Missing const constructor generates prefer_const_constructors_in_immutables warning.
NoConstConstructor({Key? key, required this.name }) : super(key: key);
final String name;
@override
Widget build(BuildContext context) {
// NO LINT: Can type local variables without omit_local_variable_types warning.
final String text = 'Hello $name';
return Container(
// LINT: "Color(0x1)" generates use_full_hex_values_for_flutter_colors warning.
color: const Color(0x1),
child: Text(text),
);
}
}
Future<void> playAsync(AnimationController controller) async {
// NO LINT: AnimationController API can be called without await and without
// marking Future as unawaited, https://github.com/dart-lang/linter/issues/2513.
controller.forward();
}
Future<void> pushAsync(NavigatorState navigator) async {
// NO LINT: Navigator API can be called without await and without
// marking Future as unawaited, https://github.com/dart-lang/linter/issues/2513.
navigator.pushNamed('foo');
}
// NO LINT: Can extend ChangeNotifier without warning, https://github.com/dart-lang/sdk/issues/45343.
class ExtendingChangeNotifier extends ChangeNotifier { }
// NO LINT: Can mixin ChangeNotifier without warning, https://github.com/dart-lang/sdk/issues/45343.
class MixingChangeNotifier with ChangeNotifier { }
// NO LINT: Can extend WidgetsBindingObserver without warning, https://github.com/dart-lang/sdk/issues/45343.
class ExtendingWidgetsBindingObserver extends WidgetsBindingObserver { }
// NO LINT: Can mixin WidgetsBindingObserver without warning, https://github.com/dart-lang/sdk/issues/45343.
class MixingWidgetsBindingObserver with WidgetsBindingObserver { }