Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 21 additions & 35 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
# This file was copied from flutter/plugins/analysis_options.yaml.
# This file is a copy of analysis_options.yaml from flutter/packages repo
# as of 2022-12-15.

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
language:
strict-casts: true
strict-raw-types: true
errors:
# treat missing required parameters as a warning (not a hint)
missing_required_param: warning
# treat missing returns as a warning (not a hint)
missing_return: warning
# allow having TODO comments in the code
todo: ignore
# allow self-reference to deprecated members (we do this because otherwise we have
# to annotate every member in every test, assert, etc, when we deprecate something)
deprecated_member_use_from_same_package: ignore
# Ignore analyzer hints for updating pubspecs when using Future or
# Stream and not importing dart:async
# Please see https://github.com/flutter/flutter/pull/24528 for details.
sdk_version_async_exported_from_core: ignore
# Turned off until null-safe rollout is complete.
unnecessary_null_comparison: ignore
### Local flutter/plugins changes ###
# Allow null checks for as long as mixed mode is officially supported.
always_require_non_null_named_parameters: false # not needed with nnbd
exclude:
exclude: # DIFFERENT FROM FLUTTER/FLUTTER
# Ignore generated files
- '**/*.g.dart'
- 'lib/src/generated/*.dart'
- '**/*.mocks.dart' # Mockito @GenerateMocks
- '**/*.pigeon.dart' # Pigeon generated file

linter:
rules:
Expand All @@ -54,19 +40,19 @@ linter:
- avoid_field_initializers_in_const_classes
# - avoid_final_parameters # incompatible with prefer_final_parameters
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # LOCAL CHANGE - Needs to be enabled and violations fixed.
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
- avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
# - avoid_print # LOCAL CHANGE - Needs to be enabled and violations fixed.
- avoid_print
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
# - avoid_returning_null # still violated by some pre-nnbd code that we haven't yet migrated
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
# - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives
Expand All @@ -88,15 +74,17 @@ linter:
# - cascade_invocations # doesn't match the typical style of this repo
- cast_nullable_to_non_nullable
# - close_sinks # not reliable enough
# - combinators_ordering # DIFFERENT FROM FLUTTER/FLUTTER: This isn't available on stable yet.
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
# - conditional_uri_does_not_exist # not yet tested
- conditional_uri_does_not_exist
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
# - curly_braces_in_flow_control_structures # not required by flutter style
# - depend_on_referenced_packages # LOCAL CHANGE - Needs to be enabled and violations fixed.
- curly_braces_in_flow_control_structures
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
- directives_ordering
# - discarded_futures # not yet tested
# - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
- empty_catches
- empty_constructor_bodies
Expand All @@ -107,7 +95,6 @@ linter:
- flutter_style_todos
- hash_and_equals
- implementation_imports
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
- iterable_contains_unrelated_type
# - join_return_with_assignment # not required by flutter style
- leading_newlines_in_multiline_strings
Expand All @@ -122,7 +109,7 @@ linter:
# - no_default_cases # LOCAL CHANGE - Needs to be enabled and violations fixed.
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
# - no_leading_underscores_for_local_identifiers # LOCAL CHANGE - Needs to be enabled and violations fixed.
- no_leading_underscores_for_local_identifiers
- no_logic_in_create_state
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
- non_constant_identifier_names
Expand Down Expand Up @@ -172,7 +159,7 @@ linter:
# - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
# - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
- prefer_null_aware_operators
# - prefer_relative_imports # LOCAL CHANGE - Needs to be enabled and violations fixed.
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
Expand All @@ -182,20 +169,20 @@ linter:
- recursive_getters
# - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
- secure_pubspec_urls
# - sized_box_for_whitespace # LOCAL CHANGE - Needs to be enabled and violations fixed.
- sized_box_for_whitespace
# - sized_box_shrink_expand # not yet tested
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
- sort_pub_dependencies # DIFFERENT FROM FLUTTER/FLUTTER: Flutter's use case for not sorting does not apply to this repository.
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # too many false positives, especially with the way AnimationController works
# - unnecessary_await_in_return # LOCAL CHANGE - Needs to be enabled and violations fixed.
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
Expand All @@ -205,6 +192,7 @@ linter:
- unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
Expand All @@ -215,6 +203,7 @@ linter:
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unrelated_type_equality_checks
- unsafe_html
# - use_build_context_synchronously # LOCAL CHANGE - Needs to be enabled and violations fixed.
Expand Down Expand Up @@ -242,6 +231,3 @@ linter:
# separately when moving to a shared file.
- no_runtimeType_toString # use objectRuntimeType from package:foundation
- public_member_api_docs # see https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#documentation-dartdocs-javadocs-etc
# Flutter has a specific use case for dependencies that are intentionally
# not sorted, which doesn't apply to this repo.
- sort_pub_dependencies
3 changes: 2 additions & 1 deletion analysis_options_plus.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This file was copied from plus_plugins/analysis_options.yaml.
# This file is a copy of analysis_options.yaml from plus_plugins repo
# as of 2023-03-07.

include: package:flutter_lints/flutter.yaml

Expand Down
12 changes: 4 additions & 8 deletions packages/camera/example/integration_test/camera_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ void main() {
Future<bool> testCaptureImageResolution(
CameraController controller, ResolutionPreset preset) async {
final Size expectedSize = presetExpectedSizes[preset]!;
print(
'Capturing photo at $preset (${expectedSize.width}x${expectedSize.height}) using camera ${controller.description.name}');

// Take Picture
final XFile file = await controller.takePicture();
Expand Down Expand Up @@ -93,8 +91,6 @@ void main() {
Future<bool> testCaptureVideoResolution(
CameraController controller, ResolutionPreset preset) async {
final Size expectedSize = presetExpectedSizes[preset]!;
print(
'Capturing video at $preset (${expectedSize.width}x${expectedSize.height}) using camera ${controller.description.name}');

// Take Video
await controller.startVideoRecording();
Expand Down Expand Up @@ -206,16 +202,16 @@ void main() {
);

await controller.initialize();
bool _isDetecting = false;
bool isDetecting = false;

await controller.startImageStream((CameraImage image) {
if (_isDetecting) {
if (isDetecting) {
return;
}

_isDetecting = true;
isDetecting = true;

expectLater(image, isNotNull).whenComplete(() => _isDetecting = false);
expectLater(image, isNotNull).whenComplete(() => isDetecting = false);
});

expect(controller.value.isStreamingImages, true);
Expand Down
7 changes: 2 additions & 5 deletions packages/camera/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ IconData getCameraLensIcon(CameraLensDirection direction) {
}

void _logError(String code, String? message) {
if (message != null) {
print('Error: $code\nError Message: $message');
} else {
print('Error: $code');
}
// ignore: avoid_print
print('Error: $code${message == null ? '' : '\nError Message: $message'}');
}

class _CameraExampleHomeState extends State<CameraExampleHome>
Expand Down
3 changes: 2 additions & 1 deletion packages/device_info_plus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import 'package:device_info_plus_tizen/device_info_plus_tizen.dart';

DeviceInfoPluginTizen deviceInfo = DeviceInfoPluginTizen();
TizenDeviceInfo tizenInfo = await deviceInfo.tizenInfo;
print('Running on ${tizenInfo.modelName}'); // e.g. "SM-R800"

String modelName = tizenInfo.modelName;
```

## Available values
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_core/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: public_member_api_docs
// ignore_for_file: public_member_api_docs, avoid_print

import 'dart:async';
import 'dart:developer';
Expand Down
16 changes: 8 additions & 8 deletions packages/firebase_core/lib/firebase_core_tizen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,26 @@ class FirebaseCore extends FirebasePlatform {

/// Ensures the name isn't null, in case no name
/// passed, [defaultFirebaseAppName] will be used
final String _name = name ?? defaultFirebaseAppName;
name ??= defaultFirebaseAppName;

try {
// Initialize the app in firebase_core_dart
final core_dart.FirebaseOptions _dartOptions =
final core_dart.FirebaseOptions dartOptions =
core_dart.FirebaseOptions.fromMap(options!.asMap);
final core_dart.FirebaseApp _dartApp =
final core_dart.FirebaseApp dartApp =
await core_dart.Firebase.initializeApp(
name: _name,
options: _dartOptions,
name: name,
options: dartOptions,
);

return _mapDartToPlatfromApp(_dartApp);
return _mapDartToPlatfromApp(dartApp);
} on core_dart.FirebaseException catch (e) {
switch (e.code) {
case 'no-app':
throw noAppExists(_name);
throw noAppExists(name);

case 'duplicate-app':
throw duplicateApp(_name);
throw duplicateApp(name);
}

rethrow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class _MapCoordinatesBodyState extends State<_MapCoordinatesBody> {
// Add a block at the bottom of this list to allow validation that the visible region of the map
// does not change when scrolled under the safe view on iOS.
// https://github.com/flutter/flutter/issues/107913
Container(
const SizedBox(
width: 300,
height: 1000,
),
Expand Down
1 change: 1 addition & 0 deletions packages/google_maps_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
flutter:
sdk: flutter
google_maps_flutter: ^2.1.7
google_maps_flutter_platform_interface: ^2.1.2
google_maps_flutter_tizen:
path: ../

Expand Down
4 changes: 2 additions & 2 deletions packages/google_maps_flutter/lib/src/circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class CircleController {
/// Circle component's tap event.
ui.VoidCallback? tapEvent;

Future<void> _addCircleEvent(Future<WebViewController>? _controller) async {
Future<void> _addCircleEvent(Future<WebViewController>? controller) async {
final String command =
"$_circle.addListener('click', (event) => CircleClick.postMessage(JSON.stringify(${_circle?.id})));";
await (await _controller!).runJavascript(command);
await (await controller!).runJavascript(command);
}

/// Returns `true` if this Controller will use its own `onTap` handler to consume events.
Expand Down
16 changes: 7 additions & 9 deletions packages/google_maps_flutter/lib/src/convert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ LatLngBounds _convertToBounds(String value) {
northeast: LatLng(bound['north'] as double, bound['east'] as double));
}
} catch (e) {
print('Javascript Error: $e');
debugPrint('Javascript Error: $e');
}
return util.nullLatLngBounds;
}
Expand All @@ -184,7 +184,7 @@ LatLng _convertToLatLng(String value) {
return LatLng((latlng['lat'] as num) + 0.0, (latlng['lng'] as num) + 0.0);
}
} catch (e) {
print('Javascript Error: $e');
debugPrint('Javascript Error: $e');
}
return util.nullLatLng;
}
Expand All @@ -205,7 +205,7 @@ ScreenCoordinate _convertToPoint(String value) {
return ScreenCoordinate(x: x, y: y);
}
} catch (e) {
print('Javascript Error: $e');
debugPrint('Javascript Error: $e');
}
return util.nullScreenCoordinate;
}
Expand Down Expand Up @@ -324,12 +324,10 @@ util.GPolygonOptions _polygonOptionsFromPolygon(Polygon polygon) {
List<LatLng> holePath = polygon.holes[i];
if (_isPolygonClockwise(holePath) == polygonDirection) {
holePath = holePath.reversed.toList();
if (kDebugMode) {
print(
'Hole [$holeIndex] in Polygon [${polygon.polygonId.value}] has been reversed.'
' Ensure holes in polygons are "wound in the opposite direction to the outer path."'
' More info: https://github.com/flutter/flutter/issues/74096');
}
debugPrint(
'Hole [$holeIndex] in Polygon [${polygon.polygonId.value}] has been reversed.'
' Ensure holes in polygons are "wound in the opposite direction to the outer path."'
' More info: https://github.com/flutter/flutter/issues/74096');
}
paths.add(holePath);
holeIndex++;
Expand Down
Loading