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/** - windows/**
- macos/** - macos/**
- linux/** - linux/**
include: package:analysis_defaults/flutter.yaml include: ../../../analysis_options.yaml

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

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

@ -7,4 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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/** - windows/**
- macos/** - macos/**
- linux/** - linux/**
include: package:analysis_defaults/flutter.yaml include: ../../../analysis_options.yaml

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

@ -7,4 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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/** - windows/**
- macos/** - macos/**
- linux/** - linux/**
include: package:analysis_defaults/flutter.yaml include: ../analysis_options.yaml

@ -7,4 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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: analyzer:
exclude: exclude:
- build/** - build/**
@ -20,20 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - linux/**
include: package:lints/recommended.yaml include: ../../analysis_options.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

@ -16,8 +16,8 @@ int main(List<String> arguments) {
..addOption(outputOptionName, mandatory: true, abbr: 'o'); ..addOption(outputOptionName, mandatory: true, abbr: 'o');
ArgResults argResults = parser.parse(arguments); ArgResults argResults = parser.parse(arguments);
final String inputFilePath = argResults[inputOptionName]; final String inputFilePath = argResults[inputOptionName] as String;
final String outputFilePath = argResults[outputOptionName]; final String outputFilePath = argResults[outputOptionName] as String;
try { try {
final Image image = decodeImage(File(inputFilePath).readAsBytesSync())!; 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:asset_transformation/main.dart';
import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('app can render without exceptions', (WidgetTester tester) async { testWidgets('app can render without exceptions', (tester) async {
await tester.pumpWidget(const MainApp()); await tester.pumpWidget(const MainApp());
}); });
} }

@ -7,4 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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: linter:
rules: rules:
- combinators_ordering - combinators_ordering
@ -18,3 +7,13 @@ linter:
- prefer_final_in_for_each - prefer_final_in_for_each
- prefer_final_locals - prefer_final_locals
- prefer_relative_imports - prefer_relative_imports
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

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

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

@ -52,7 +52,7 @@ class SearchFormContinent extends StatelessWidget {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: viewModel.continents.length, itemCount: viewModel.continents.length,
padding: Dimens.of(context).edgeInsetsScreenHorizontal, padding: Dimens.of(context).edgeInsetsScreenHorizontal,
itemBuilder: (BuildContext context, int index) { itemBuilder: (context, index) {
final Continent(:imageUrl, :name) = viewModel.continents[index]; final Continent(:imageUrl, :name) = viewModel.continents[index];
return _CarouselItem( return _CarouselItem(
key: ValueKey(name), key: ValueKey(name),
@ -61,7 +61,7 @@ class SearchFormContinent extends StatelessWidget {
viewModel: viewModel, viewModel: viewModel,
); );
}, },
separatorBuilder: (BuildContext context, int index) { separatorBuilder: (context, index) {
return const SizedBox(width: 8); 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 mockNetworkImages(() async {
await loadScreen(tester); await loadScreen(tester);
expect(find.byType(ActivitiesScreen), findsOneWidget); expect(find.byType(ActivitiesScreen), findsOneWidget);
}); });
}); });
testWidgets('should list activity', (WidgetTester tester) async { testWidgets('should list activity', (tester) async {
await mockNetworkImages(() async { await mockNetworkImages(() async {
await loadScreen(tester); await loadScreen(tester);
expect(find.byType(ActivityEntry), findsOneWidget); expect(find.byType(ActivityEntry), findsOneWidget);
@ -61,7 +61,7 @@ void main() {
}); });
testWidgets('should select activity and confirm', ( testWidgets('should select activity and confirm', (
WidgetTester tester, tester,
) async { ) async {
await mockNetworkImages(() async { await mockNetworkImages(() async {
await loadScreen(tester); 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 mockNetworkImages(() async {
await loadScreen(tester); await loadScreen(tester);
expect(find.byType(LoginScreen), findsOneWidget); expect(find.byType(LoginScreen), findsOneWidget);
}); });
}); });
testWidgets('should perform login', (WidgetTester tester) async { testWidgets('should perform login', (tester) async {
await mockNetworkImages(() async { await mockNetworkImages(() async {
await loadScreen(tester); 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 mockNetworkImages(() async {
await loadScreen(tester); await loadScreen(tester);
expect(find.byType(LogoutButton), findsOneWidget); expect(find.byType(LogoutButton), findsOneWidget);
}); });
}); });
testWidgets('should perform logout', (WidgetTester tester) async { testWidgets('should perform logout', (tester) async {
await mockNetworkImages(() async { await mockNetworkImages(() async {
await loadScreen(tester); await loadScreen(tester);

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

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

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

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

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

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async';
import 'package:compass_app/utils/command.dart'; import 'package:compass_app/utils/command.dart';
import 'package:compass_app/utils/result.dart'; import 'package:compass_app/utils/result.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@ -53,10 +55,10 @@ void main() {
final future = command.execute(); final future = command.execute();
// Run multiple times // Run multiple times
command.execute(); unawaited(command.execute());
command.execute(); unawaited(command.execute());
command.execute(); unawaited(command.execute());
command.execute(); unawaited(command.execute());
// Await execution // Await execution
await future; 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. // For running in containers, we respect the PORT environment variable.
final port = int.parse(Platform.environment['PORT'] ?? '8080'); final port = int.parse(Platform.environment['PORT'] ?? '8080');
final server = await serve(handler, ip, port); final server = await serve(handler, ip, port);
// ignore: avoid_print
print('Server listening on port ${server.port}'); 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: analyzer:
exclude: exclude:
- build/** - build/**
@ -16,22 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -54,7 +54,7 @@ class CustomCupertinoListTile extends StatelessWidget {
onTap: () { onTap: () {
Navigator.of(context).push( Navigator.of(context).push(
CupertinoPageRoute<void>( CupertinoPageRoute<void>(
builder: (BuildContext context) { builder: (context) {
return WidgetDetailPage(title: title); 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: analyzer:
exclude: exclude:
- build/** - build/**
@ -16,22 +7,8 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - linux/**
include: package:flutter_lints/flutter.yaml include: ../analysis_options.yaml
linter: 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: rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule sort_pub_dependencies: true
# 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

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

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

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

@ -7,7 +7,7 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - linux/**
include: package:analysis_defaults/flutter.yaml include: ../../analysis_options.yaml
linter: linter:
rules: 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: analyzer:
exclude: exclude:
- build/** - build/**
@ -16,22 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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

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

@ -7,4 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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: analyzer:
exclude: exclude:
- lib/src/*.g.dart - lib/src/*.g.dart
- build/** - build/**
- android/** - android/**

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

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

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

@ -1,3 +1,5 @@
include: ../analysis_options.yaml
analyzer: analyzer:
exclude: exclude:
- build/** - build/**
@ -7,7 +9,3 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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: analyzer:
exclude: exclude:
- build/** - build/**
@ -16,23 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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-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

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

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

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

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

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

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

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

@ -7,4 +7,4 @@ analyzer:
- windows/** - windows/**
- macos/** - macos/**
- linux/** - 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:convert';
import 'dart:io'; import 'dart:io';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart'; import 'package:yaml/yaml.dart';
@ -38,8 +41,9 @@ Future<void> main() async {
final packages = workspace final packages = workspace
.where((e) { .where((e) {
if (skipCiList != null && skipCiList.contains(e)) return false; if (skipCiList != null && skipCiList.contains(e)) return false;
if (channelSkipList != null && channelSkipList.contains(e)) if (channelSkipList != null && channelSkipList.contains(e)) {
return false; return false;
}
return true; return true;
}) })
.map((e) => e.toString()) .map((e) => e.toString())
@ -99,7 +103,9 @@ Future<String> _getFlutterChannel() async {
'--machine', '--machine',
], runInShell: true); ], runInShell: true);
if (result.exitCode != 0) { 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('Stdout: ${result.stdout}');
print('Stderr: ${result.stderr}'); print('Stderr: ${result.stderr}');
return 'unknown'; return 'unknown';

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

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

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

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

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

Loading…
Cancel
Save