Analysis_options, format and fixups. (#103)

pull/109/head
Brett Morgan 5 years ago committed by GitHub
parent 52d85c793e
commit 87b42f92e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,30 @@
include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
linter:
rules:
- avoid_types_on_closure_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- close_sinks
- constant_identifier_names
- control_flow_in_finally
- empty_statements
- hash_and_equals
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -18,7 +18,7 @@ import 'page_one.dart';
import 'page_two.dart'; import 'page_two.dart';
import 'page_three.dart'; import 'page_three.dart';
void main() => runApp(new MaterialApp(home: new StartApp())); void main() => runApp(MaterialApp(home: StartApp()));
class StartApp extends StatelessWidget { class StartApp extends StatelessWidget {
@override @override

@ -37,7 +37,7 @@ class _PerformancePageState extends State<PerformancePage> {
children: [ children: [
FutureBuilder<void>( FutureBuilder<void>(
future: computeFuture, future: computeFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) { builder: (context, snapshot) {
return RaisedButton( return RaisedButton(
child: const Text('Compute on Main'), child: const Text('Compute on Main'),
elevation: 8.0, elevation: 8.0,
@ -47,7 +47,7 @@ class _PerformancePageState extends State<PerformancePage> {
), ),
FutureBuilder<void>( FutureBuilder<void>(
future: computeFuture, future: computeFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) { builder: (context, snapshot) {
return RaisedButton( return RaisedButton(
child: const Text('Compute on Secondary'), child: const Text('Compute on Secondary'),
elevation: 8.0, elevation: 8.0,
@ -133,7 +133,7 @@ class SmoothAnimationWidget extends StatefulWidget {
class SmoothAnimationWidgetState extends State<SmoothAnimationWidget> class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
with TickerProviderStateMixin { with TickerProviderStateMixin {
AnimationController _controller; AnimationController _controller;
var borderRadius; Animation<BorderRadius> borderRadius;
@override @override
void initState() { void initState() {
@ -168,10 +168,10 @@ class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AnimatedBuilder( return AnimatedBuilder(
animation: borderRadius, animation: borderRadius,
builder: (BuildContext context, Widget child) { builder: (context, child) {
return Center( return Center(
child: Container( child: Container(
child: new FlutterLogo( child: FlutterLogo(
size: 200, size: 200,
), ),
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,

@ -40,7 +40,7 @@ class InfiniteProcessPage extends StatelessWidget {
'Summation Results', 'Summation Results',
style: Theme.of(context).textTheme.title, style: Theme.of(context).textTheme.title,
), ),
padding: new EdgeInsets.all(8), padding: EdgeInsets.all(8),
), ),
Expanded(child: RunningList()), Expanded(child: RunningList()),
SafeArea( SafeArea(
@ -97,7 +97,7 @@ class InfiniteProcessIsolateController extends ChangeNotifier {
} }
void listen() { void listen() {
mIceRP.listen((message) { mIceRP.listen((dynamic message) {
if (message is SendPort) { if (message is SendPort) {
newIceSP = message; newIceSP = message;
newIceSP.send(_currentMultiplier); newIceSP.send(_currentMultiplier);
@ -166,7 +166,7 @@ class RunningList extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[200], color: Colors.grey[200],
), ),
child: new ListView.builder( child: ListView.builder(
itemCount: sums.length, itemCount: sums.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Column( return Column(
@ -198,7 +198,7 @@ Future<void> _secondIsolateEntryPoint(SendPort callerSP) async {
ReceivePort newIceRP = ReceivePort(); ReceivePort newIceRP = ReceivePort();
callerSP.send(newIceRP.sendPort); callerSP.send(newIceRP.sendPort);
newIceRP.listen((message) { newIceRP.listen((dynamic message) {
if (message is int) multiplyValue = message; if (message is int) multiplyValue = message;
}); });
@ -216,7 +216,7 @@ Future<void> _secondIsolateEntryPoint(SendPort callerSP) async {
} }
Future<int> brokenUpComputation(int num) { Future<int> brokenUpComputation(int num) {
Random rng = new Random(); Random rng = Random();
return Future(() { return Future(() {
int sum = 0; int sum = 0;
@ -228,7 +228,7 @@ Future<int> brokenUpComputation(int num) {
}); });
} }
Widget newButtons(context) { Widget newButtons(BuildContext context) {
final controller = final controller =
Provider.of<InfiniteProcessIsolateController>(context, listen: false); Provider.of<InfiniteProcessIsolateController>(context, listen: false);
@ -249,30 +249,34 @@ Widget newButtons(context) {
); );
} }
Widget radioButtonWidget(context) { Widget radioButtonWidget(BuildContext context) {
final controller = Provider.of<InfiniteProcessIsolateController>(context); final controller = Provider.of<InfiniteProcessIsolateController>(context);
return new Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
new Radio( Radio(
value: 1, value: 1,
groupValue: controller.multiplier, groupValue: controller.multiplier,
onChanged: (_) => controller.setMultiplier(1), // The following is a result of https://github.com/dart-lang/linter/issues/695
// ignore: avoid_types_on_closure_parameters
onChanged: (int _) => controller.setMultiplier(1),
), ),
new Text('1x'), Text('1x'),
new Radio( Radio(
value: 2, value: 2,
groupValue: controller.multiplier, groupValue: controller.multiplier,
onChanged: (_) => controller.setMultiplier(2), // ignore: avoid_types_on_closure_parameters
onChanged: (int _) => controller.setMultiplier(2),
), ),
new Text('2x'), Text('2x'),
new Radio( Radio(
value: 3, value: 3,
groupValue: controller.multiplier, groupValue: controller.multiplier,
onChanged: (_) => controller.setMultiplier(3), // ignore: avoid_types_on_closure_parameters
onChanged: (int _) => controller.setMultiplier(3),
), ),
new Text('3x'), Text('3x'),
], ],
); );
} }

@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.2.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -68,7 +68,7 @@ packages:
source: hosted source: hosted
version: "1.6.2" version: "1.6.2"
pedantic: pedantic:
dependency: transitive dependency: "direct dev"
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
@ -87,7 +87,7 @@ packages:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.3"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -134,7 +134,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.4" version: "0.2.5"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

@ -14,6 +14,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
pedantic: ^1.5.0
flutter: flutter:

@ -15,7 +15,7 @@
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('This test will always pass', (WidgetTester tester) async { testWidgets('This test will always pass', (tester) async {
return true; return true;
}); });
} }

Loading…
Cancel
Save