Update analysis options

pull/2879/head
Eric Windmill 1 month ago
parent 2247c50517
commit 080f181868
No known key found for this signature in database

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../../analysis_options.yaml

@ -1,4 +0,0 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../../analysis_options.yaml

@ -0,0 +1,11 @@
include: package:analysis_defaults/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -1,16 +1,3 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
analyzer:
exclude:
- build/**
@ -20,20 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
include: ../../analysis_options.yaml

@ -16,8 +16,8 @@ int main(List<String> arguments) {
..addOption(outputOptionName, mandatory: true, abbr: 'o');
ArgResults argResults = parser.parse(arguments);
final String inputFilePath = argResults[inputOptionName];
final String outputFilePath = argResults[outputOptionName];
final String inputFilePath = argResults[inputOptionName] as String;
final String outputFilePath = argResults[outputOptionName] as String;
try {
final Image image = decodeImage(File(inputFilePath).readAsBytesSync())!;

@ -1,8 +1,8 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:asset_transformation/main.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('app can render without exceptions', (WidgetTester tester) async {
testWidgets('app can render without exceptions', (tester) async {
await tester.pumpWidget(const MainApp());
});
}

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -1,14 +1,3 @@
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
linter:
rules:
- combinators_ordering
@ -18,3 +7,13 @@ linter:
- prefer_final_in_for_each
- prefer_final_locals
- prefer_relative_imports
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

@ -85,7 +85,6 @@ class BookingCreateUseCase {
switch (saveBookingResult) {
case Ok<void>():
_log.fine('Booking saved successfully');
break;
case Error<void>():
_log.warning('Failed to save booking', saveBookingResult.error);
return Result.error(saveBookingResult.error);

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
class AppLocalization {
static AppLocalization of(BuildContext context) {
return Localizations.of(context, AppLocalization);
return Localizations.of<AppLocalization>(context, AppLocalization)!;
}
static const _strings = <String, String>{
@ -53,11 +53,13 @@ class AppLocalization {
String get daytime => _get('daytime');
String get errorWhileLoadingActivities => _get('errorWhileLoadingActivities');
String get errorWhileLoadingActivities =>
_get('errorWhileLoadingActivities');
String get errorWhileLoadingBooking => _get('errorWhileLoadingBooking');
String get errorWhileLoadingContinents => _get('errorWhileLoadingContinents');
String get errorWhileLoadingContinents =>
_get('errorWhileLoadingContinents');
String get errorWhileLoadingDestinations =>
_get('errorWhileLoadingDestinations');
@ -98,7 +100,8 @@ class AppLocalization {
String get errorWhileDeletingBooking => _get('errorWhileDeletingBooking');
String nameTrips(String name) => _get('nameTrips').replaceAll('{name}', name);
String nameTrips(String name) =>
_get('nameTrips').replaceAll('{name}', name);
String selected(int value) =>
_get('selected').replaceAll('{1}', value.toString());

@ -52,7 +52,7 @@ class SearchFormContinent extends StatelessWidget {
scrollDirection: Axis.horizontal,
itemCount: viewModel.continents.length,
padding: Dimens.of(context).edgeInsetsScreenHorizontal,
itemBuilder: (BuildContext context, int index) {
itemBuilder: (context, index) {
final Continent(:imageUrl, :name) = viewModel.continents[index];
return _CarouselItem(
key: ValueKey(name),
@ -61,7 +61,7 @@ class SearchFormContinent extends StatelessWidget {
viewModel: viewModel,
);
},
separatorBuilder: (BuildContext context, int index) {
separatorBuilder: (context, index) {
return const SizedBox(width: 8);
},
);

@ -45,14 +45,14 @@ void main() {
);
}
testWidgets('should load screen', (WidgetTester tester) async {
testWidgets('should load screen', (tester) async {
await mockNetworkImages(() async {
await loadScreen(tester);
expect(find.byType(ActivitiesScreen), findsOneWidget);
});
});
testWidgets('should list activity', (WidgetTester tester) async {
testWidgets('should list activity', (tester) async {
await mockNetworkImages(() async {
await loadScreen(tester);
expect(find.byType(ActivityEntry), findsOneWidget);
@ -61,7 +61,7 @@ void main() {
});
testWidgets('should select activity and confirm', (
WidgetTester tester,
tester,
) async {
await mockNetworkImages(() async {
await loadScreen(tester);

@ -32,14 +32,14 @@ void main() {
);
}
testWidgets('should load screen', (WidgetTester tester) async {
testWidgets('should load screen', (tester) async {
await mockNetworkImages(() async {
await loadScreen(tester);
expect(find.byType(LoginScreen), findsOneWidget);
});
});
testWidgets('should perform login', (WidgetTester tester) async {
testWidgets('should perform login', (tester) async {
await mockNetworkImages(() async {
await loadScreen(tester);

@ -43,14 +43,14 @@ void main() {
);
}
testWidgets('should load widget', (WidgetTester tester) async {
testWidgets('should load widget', (tester) async {
await mockNetworkImages(() async {
await loadScreen(tester);
expect(find.byType(LogoutButton), findsOneWidget);
});
});
testWidgets('should perform logout', (WidgetTester tester) async {
testWidgets('should perform logout', (tester) async {
await mockNetworkImages(() async {
await loadScreen(tester);

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:compass_app/domain/models/itinerary_config/itinerary_config.dart';
import 'package:compass_app/domain/use_cases/booking/booking_create_use_case.dart';
import 'package:compass_app/domain/use_cases/booking/booking_share_use_case.dart';
@ -62,20 +64,20 @@ void main() {
);
}
testWidgets('should load screen', (WidgetTester tester) async {
testWidgets('should load screen', (tester) async {
await loadScreen(tester);
expect(find.byType(BookingScreen), findsOneWidget);
});
testWidgets('should display booking from ID', (WidgetTester tester) async {
testWidgets('should display booking from ID', (tester) async {
// Add a booking to repository
bookingRepository.createBooking(kBooking);
unawaited(bookingRepository.createBooking(kBooking));
// Load screen
await loadScreen(tester);
// Load booking with ID 0
viewModel.loadBooking.execute(0);
unawaited(viewModel.loadBooking.execute(0));
// Wait for booking to load
await tester.pumpAndSettle();
@ -85,12 +87,12 @@ void main() {
});
testWidgets('should create booking from itinerary config', (
WidgetTester tester,
tester,
) async {
await loadScreen(tester);
// Create a new booking from stored itinerary config
viewModel.createBooking.execute();
unawaited(viewModel.createBooking.execute());
// Wait for booking to load
await tester.pumpAndSettle();
@ -102,10 +104,10 @@ void main() {
expect(bookingRepository.bookings.length, 1);
});
testWidgets('should share booking', (WidgetTester tester) async {
bookingRepository.createBooking(kBooking);
testWidgets('should share booking', (tester) async {
unawaited(bookingRepository.createBooking(kBooking));
await loadScreen(tester);
viewModel.loadBooking.execute(0);
unawaited(viewModel.loadBooking.execute(0));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('share-button')));
expect(shared, true);

@ -42,14 +42,14 @@ void main() {
);
}
testWidgets('should load screen', (WidgetTester tester) async {
testWidgets('should load screen', (tester) async {
await mockNetworkImages(() async {
await loadScreen(tester);
expect(find.byType(ResultsScreen), findsOneWidget);
});
});
testWidgets('should display destination', (WidgetTester tester) async {
testWidgets('should display destination', (tester) async {
await mockNetworkImages(() async {
await loadScreen(tester);
@ -63,7 +63,7 @@ void main() {
});
testWidgets('should tap and navigate to activities', (
WidgetTester tester,
tester,
) async {
await mockNetworkImages(() async {
await loadScreen(tester);

@ -26,7 +26,7 @@ void main() {
}
testWidgets('Should load and select continent', (
WidgetTester tester,
tester,
) async {
await loadWidget(tester);
expect(find.byType(SearchFormContinent), findsOneWidget);

@ -27,7 +27,7 @@ void main() {
}
testWidgets('should display date in different month', (
WidgetTester tester,
tester,
) async {
await loadWidget(tester);
expect(find.byType(SearchFormDate), findsOneWidget);
@ -46,7 +46,7 @@ void main() {
});
testWidgets('should display date in same month', (
WidgetTester tester,
tester,
) async {
await loadWidget(tester);
expect(find.byType(SearchFormDate), findsOneWidget);

@ -26,7 +26,7 @@ void main() {
await testApp(tester, SearchFormGuests(viewModel: viewModel));
}
testWidgets('Increase number of guests', (WidgetTester tester) async {
testWidgets('Increase number of guests', (tester) async {
await loadWidget(tester);
expect(find.byType(SearchFormGuests), findsOneWidget);
@ -39,7 +39,7 @@ void main() {
expect(find.text('1'), findsOneWidget);
});
testWidgets('Decrease number of guests', (WidgetTester tester) async {
testWidgets('Decrease number of guests', (tester) async {
await loadWidget(tester);
expect(find.byType(SearchFormGuests), findsOneWidget);

@ -47,7 +47,7 @@ void main() {
}
testWidgets('Should fill form and perform search', (
WidgetTester tester,
tester,
) async {
await loadWidget(tester);
expect(find.byType(SearchFormScreen), findsOneWidget);

@ -34,7 +34,7 @@ void main() {
);
}
testWidgets('Should be enabled and allow tap', (WidgetTester tester) async {
testWidgets('Should be enabled and allow tap', (tester) async {
await loadWidget(tester);
expect(find.byType(SearchFormSubmit), findsOneWidget);

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:compass_app/utils/command.dart';
import 'package:compass_app/utils/result.dart';
import 'package:flutter_test/flutter_test.dart';
@ -53,10 +55,10 @@ void main() {
final future = command.execute();
// Run multiple times
command.execute();
command.execute();
command.execute();
command.execute();
unawaited(command.execute());
unawaited(command.execute());
unawaited(command.execute());
unawaited(command.execute());
// Await execution
await future;

@ -0,0 +1,19 @@
linter:
rules:
- combinators_ordering
- directives_ordering
- omit_local_variable_types
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_relative_imports
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

@ -35,5 +35,6 @@ void main(List<String> args) async {
// For running in containers, we respect the PORT environment variable.
final port = int.parse(Platform.environment['PORT'] ?? '8080');
final server = await serve(handler, ip, port);
// ignore: avoid_print
print('Server listening on port ${server.port}');
}

@ -1,12 +1,3 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
@ -16,22 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
include: ../analysis_options.yaml

@ -31,9 +31,9 @@ class GalleryHome extends StatelessWidget {
),
],
),
tabBuilder: (BuildContext context, int index) {
tabBuilder: (context, index) {
return CupertinoTabView(
builder: (BuildContext context) {
builder: (context) {
return switch (index) {
0 => const WidgetsPage(),
1 => SettingsPage(

@ -54,7 +54,7 @@ class _SettingsPageState extends State<SettingsPage> {
title: const Text('Dark Mode'),
trailing: CupertinoSwitch(
value: isDarkMode,
onChanged: (bool isActive) {
onChanged: (isActive) {
setState(() {
isDarkMode = isActive;
widget.onThemeChange(isActive);
@ -70,7 +70,7 @@ class _SettingsPageState extends State<SettingsPage> {
value: _textSize,
min: 0.5,
max: 1.5,
onChanged: (double value) {
onChanged: (value) {
setState(() {
_textSize = value;
});
@ -103,7 +103,7 @@ class _SettingsPageState extends State<SettingsPage> {
onTap: () {
showCupertinoDialog<void>(
context: context,
builder: (BuildContext context) => CupertinoAlertDialog(
builder: (context) => CupertinoAlertDialog(
title: const Text('Reset Settings'),
content: const Text(
'Are you sure you want to reset all settings?',

@ -13,7 +13,7 @@ class ActionSheetPage extends StatelessWidget {
onPressed: () {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) => CupertinoActionSheet(
builder: (context) => CupertinoActionSheet(
title: const Text('Title'),
message: const Text('Message'),
actions: <CupertinoActionSheetAction>[

@ -13,7 +13,7 @@ class AlertDialogPage extends StatelessWidget {
onPressed: () {
showCupertinoDialog<void>(
context: context,
builder: (BuildContext context) => CupertinoAlertDialog(
builder: (context) => CupertinoAlertDialog(
title: const Text('Alert'),
content: const Text('This is a sample alert dialog.'),
actions: <CupertinoDialogAction>[

@ -17,7 +17,7 @@ class _CheckboxPageState extends State<CheckboxPage> {
child: Center(
child: CupertinoCheckbox(
value: _value,
onChanged: (bool? value) {
onChanged: (value) {
setState(() {
_value = value!;
});

@ -10,7 +10,7 @@ class DatePickerPage extends StatelessWidget {
child: Center(
child: SizedBox(
height: 200,
child: CupertinoDatePicker(onDateTimeChanged: (DateTime newDate) {}),
child: CupertinoDatePicker(onDateTimeChanged: (newDate) {}),
),
),
);

@ -12,7 +12,7 @@ class PickerPage extends StatelessWidget {
height: 200,
child: CupertinoPicker(
itemExtent: 32,
onSelectedItemChanged: (int index) {},
onSelectedItemChanged: (index) {},
children: const <Widget>[Text('One'), Text('Two'), Text('Three')],
),
),

@ -15,7 +15,7 @@ class PopupSurfacePage extends StatelessWidget {
onPressed: () {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) {
builder: (context) {
return CupertinoPopupSurface(
child: Container(
color: CupertinoColors.white,

@ -17,7 +17,7 @@ class _RadioPageState extends State<RadioPage> {
child: Center(
child: RadioGroup(
groupValue: _selectedValue,
onChanged: (int? value) {
onChanged: (value) {
setState(() {
_selectedValue = value!;
});

@ -13,10 +13,10 @@ class ScrollbarPage extends StatelessWidget {
child: ListView.separated(
controller: controller,
itemCount: 100,
itemBuilder: (BuildContext context, int index) {
itemBuilder: (context, index) {
return CupertinoListTile(title: Text('Item $index'));
},
separatorBuilder: (BuildContext context, int index) {
separatorBuilder: (context, index) {
return Container(height: 1, color: CupertinoColors.opaqueSeparator);
},
),

@ -23,7 +23,7 @@ class _SegmentedControlPageState extends State<SegmentedControlPage> {
1: Text('Two'),
2: Text('Three'),
},
onValueChanged: (int val) {
onValueChanged: (val) {
setState(() {
_selectedIndex = val;
});

@ -14,7 +14,7 @@ class SheetPage extends StatelessWidget {
Navigator.of(context).push(
CupertinoSheetRoute<void>(
scrollableBuilder:
(BuildContext context, ScrollController controller) {
(context, controller) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: const Text('Sheet'),

@ -17,7 +17,7 @@ class _SliderPageState extends State<SliderPage> {
child: Center(
child: CupertinoSlider(
value: _value,
onChanged: (double value) {
onChanged: (value) {
setState(() {
_value = value;
});

@ -25,7 +25,7 @@ class _SlidingSegmentedControlPageState
1: Text('Two'),
2: Text('Three'),
},
onValueChanged: (int? value) {
onValueChanged: (value) {
setState(() {
_groupValue = value;
});

@ -17,7 +17,7 @@ class _SwitchPageState extends State<SwitchPage> {
child: Center(
child: CupertinoSwitch(
value: _value,
onChanged: (bool value) {
onChanged: (value) {
setState(() {
_value = value;
});

@ -11,7 +11,7 @@ class TimePickerPage extends StatelessWidget {
child: SizedBox(
height: 200,
child: CupertinoTimerPicker(
onTimerDurationChanged: (Duration newDuration) {},
onTimerDurationChanged: (newDuration) {},
),
),
),

@ -54,7 +54,7 @@ class CustomCupertinoListTile extends StatelessWidget {
onTap: () {
Navigator.of(context).push(
CupertinoPageRoute<void>(
builder: (BuildContext context) {
builder: (context) {
return WidgetDetailPage(title: title);
},
),

@ -1,12 +1,3 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
@ -16,22 +7,8 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
include: ../analysis_options.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
sort_pub_dependencies: true

@ -16,7 +16,7 @@ class EventList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer<EventData>(
builder: (BuildContext context, EventData events, Widget? child) {
builder: (context, events, child) {
return CupertinoPageScaffold(
// TODO(mit-mit): Avoid having to pass nav bar manually.
//

@ -8,9 +8,9 @@ environment:
sdk: ^3.9.0-0
dependencies:
cupertino_icons: ^1.0.8
flutter:
sdk: flutter
cupertino_icons: ^1.0.8
intl:
provider:
uuid:

@ -7,7 +7,7 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../analysis_options.yaml
linter:
rules:

@ -7,7 +7,7 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../../analysis_options.yaml
linter:
rules:

@ -1,12 +1,3 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
@ -16,22 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
include: ../analysis_options.yaml

@ -79,7 +79,7 @@ class _GenerativeAISampleState extends State<GenerativeAISample> {
_ => ApiKeyWidget(
title: widget.title,
onSubmitted: (key) {
setState(() => apiKey = key);
setState(() => apiKey = key as String);
},
),
},
@ -166,7 +166,9 @@ class _ExampleState extends State<Example> {
try {
final prompt = StringBuffer();
prompt.writeln(message);
final response = await callWithActions([Content.text(prompt.toString())]);
final response = await callWithActions([
Content.text(prompt.toString()),
]);
if (response.text != null) {
addMessage(Sender.system, response.text!);
} else {
@ -209,7 +211,6 @@ class _ExampleState extends State<Example> {
}),
);
}
break;
case 'change_theme_mode':
final mode = args['mode'] as String;
themeMode.value = switch (mode) {
@ -224,7 +225,6 @@ class _ExampleState extends State<Example> {
'message': 'theme mode updated',
}),
);
break;
case 'change_text_scale_factor':
final value = args['scale'] as num;
textScaleFactor.value = value.toDouble();
@ -234,7 +234,6 @@ class _ExampleState extends State<Example> {
'message': 'font scale updated',
}),
);
break;
default:
}
}

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -1,7 +1,7 @@
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml
analyzer:
exclude:
exclude:
- lib/src/*.g.dart
- build/**
- android/**

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -1,3 +1,5 @@
include: ../analysis_options.yaml
analyzer:
exclude:
- build/**
@ -7,7 +9,3 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

@ -1,12 +1,3 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
@ -16,23 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
include: ../../analysis_options.yaml

@ -54,7 +54,7 @@ class _HomeState extends State<Home> {
super.initState();
}
void runPedometer() async {
Future<void> runPedometer() async {
final now = DateTime.now();
hourlySteps = await StepsRepo.instance.getSteps();
lastUpdated = now;

@ -90,6 +90,7 @@ class _IOSStepsRepo implements StepsRepo {
return [];
}
// ignore: inference_failure_on_collection_literal
final handlers = [];
final futures = <Future<Steps?>>[];
final now = DateTime.now();
@ -102,8 +103,8 @@ class _IOSStepsRepo implements StepsRepo {
final handler = helpLib.wrapCallback(
pd.ObjCBlock_ffiVoid_CMPedometerData_NSError.listener(lib, (
pd.CMPedometerData? result,
pd.NSError? error,
result,
error,
) {
if (result != null) {
final stepCount = result.numberOfSteps.intValue;

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:analysis_defaults/flutter.yaml
include: ../analysis_options.yaml

@ -1,5 +1,8 @@
// ignore_for_file: avoid_print,
import 'dart:convert';
import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';
@ -38,8 +41,9 @@ Future<void> main() async {
final packages = workspace
.where((e) {
if (skipCiList != null && skipCiList.contains(e)) return false;
if (channelSkipList != null && channelSkipList.contains(e))
if (channelSkipList != null && channelSkipList.contains(e)) {
return false;
}
return true;
})
.map((e) => e.toString())
@ -99,7 +103,9 @@ Future<String> _getFlutterChannel() async {
'--machine',
], runInShell: true);
if (result.exitCode != 0) {
print('Flutter version command failed with exit code ${result.exitCode}');
print(
'Flutter version command failed with exit code ${result.exitCode}',
);
print('Stdout: ${result.stdout}');
print('Stderr: ${result.stderr}');
return 'unknown';

@ -1,4 +1,7 @@
// ignore_for_file: avoid_print,
import 'dart:io';
import 'package:args/args.dart';
import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';

@ -1,4 +1,7 @@
// ignore_for_file: avoid_print,
import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';

@ -163,7 +163,7 @@ class ReleaseScriptRunner {
Future<bool> _processProject(String projectPath, String dartVersion) async {
final projectName = p.basename(projectPath);
final projectDir = Directory(projectPath);
final issues = [];
final issues = <String>[];
if (!projectDir.existsSync()) {
log(red.wrap('Project directory not found: $projectPath'), stderr);
@ -174,7 +174,10 @@ class ReleaseScriptRunner {
log(styleBold.wrap('Processing project: $projectName'), stdout);
log(styleBold.wrap('=========================================')!, stdout);
log(blue.wrap('Updating SDK constraints to use Dart $dartVersion'), stdout);
log(
blue.wrap('Updating SDK constraints to use Dart $dartVersion'),
stdout,
);
if (!_isDryRun) {
if (!await _updateSdkConstraints(projectPath, dartVersion)) {
log(
@ -191,7 +194,10 @@ class ReleaseScriptRunner {
'--fatal-infos',
'--fatal-warnings',
]),
Command('dart format', 'Running dart format...', 'dart', ['format', '.']),
Command('dart format', 'Running dart format...', 'dart', [
'format',
'.',
]),
];
final testDir = Directory(p.join(projectPath, 'test'));
@ -211,7 +217,10 @@ class ReleaseScriptRunner {
);
if (!didPass) {
log(red.wrap('${command.displayName} failed for $projectName'), stderr);
log(
red.wrap('${command.displayName} failed for $projectName'),
stderr,
);
if (command.displayName == 'pub upgrade' ||
command.displayName == 'pub get' &&
@ -234,7 +243,7 @@ class ReleaseScriptRunner {
if (issues.isNotEmpty) {
logToFile('- Issues found in $projectName');
for (final issue in issues) {
for (final String issue in issues) {
if (_isOnlyWhitespace(issue)) continue;
logToFile('-- $issue');
}
@ -255,7 +264,7 @@ class ReleaseScriptRunner {
}
try {
final newConstraint = '^${versionString}-0';
final newConstraint = '^$versionString-0';
final content = await pubspecFile.readAsString();
final editor = YamlEditor(content);
@ -307,16 +316,18 @@ class ReleaseScriptRunner {
.transform(SystemEncoding().decoder)
.forEach((line) {
log(line, stdout);
if (!_isOnlyWhitespace(line))
output.writeln('${line.trim().padLeft(2)}');
if (!_isOnlyWhitespace(line)) {
output.writeln(line.trim().padLeft(2));
}
});
final stderrFuture = process.stderr
.transform(SystemEncoding().decoder)
.forEach((line) {
log(red.wrap(line), stderr);
if (!_isOnlyWhitespace(line))
output.writeln('${line.trim().padLeft(2)}');
if (!_isOnlyWhitespace(line)) {
output.writeln(line.trim().padLeft(2));
}
});
await Future.wait([stdoutFuture, stderrFuture]);
@ -325,7 +336,10 @@ class ReleaseScriptRunner {
}
void _printSummary(int total, List<String> failed) {
log(styleBold.wrap('\n=========================================')!, stdout);
log(
styleBold.wrap('\n=========================================')!,
stdout,
);
log(styleBold.wrap('Update Summary')!, stdout);
log(styleBold.wrap('=========================================')!, stdout);
log(blue.wrap('Total projects processed: $total'), stdout);

@ -90,16 +90,12 @@ class _MyAppState extends State<MyApp> {
switch (screenString) {
case 'counter':
_currentDemoScreen = DemoScreen.counter;
break;
case 'textField':
_currentDemoScreen = DemoScreen.textField;
break;
case 'custom':
_currentDemoScreen = DemoScreen.custom;
break;
default:
_currentDemoScreen = DemoScreen.counter;
break;
}
});
}

@ -1,4 +1,4 @@
include: package:flutter_lints/flutter.yaml
include: ../../../analysis_options.yaml
analyzer:
exclude:

Loading…
Cancel
Save