chore: more dart lints (#30665)
Some checks failed
CLI Build / CLI Publish (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Docker / pre-job (push) Has been cancelled
Docs build / pre-job (push) Has been cancelled
Zizmor / Zizmor (push) Has been cancelled
Static Code Analysis / pre-job (push) Has been cancelled
Test / pre-job (push) Has been cancelled
Test / ShellCheck (push) Has been cancelled
Test / OpenAPI Clients (push) Has been cancelled
Test / SQL Schema Checks (push) Has been cancelled
CLI Build / Docker (push) Has been cancelled
Docker / Re-Tag ML (push) Has been cancelled
Docker / Re-Tag Server (push) Has been cancelled
Docker / Build and Push ML (push) Has been cancelled
Docker / Build and Push Server (push) Has been cancelled
Docker / Mirror to Docker Hub (push) Has been cancelled
Docker / Docker Build & Push Server Success (push) Has been cancelled
Docker / Docker Build & Push ML Success (push) Has been cancelled
Docs build / Docs Build (push) Has been cancelled
Static Code Analysis / Run Dart Code Analysis (push) Has been cancelled
Test / Scripts unit tests (push) Has been cancelled
Test / Test & Lint Server (push) Has been cancelled
Test / Unit Test CLI (push) Has been cancelled
Test / Unit Test CLI (Windows) (push) Has been cancelled
Test / Lint Web (push) Has been cancelled
Test / Test Web (push) Has been cancelled
Test / Test i18n (push) Has been cancelled
Test / End-to-End Lint (push) Has been cancelled
Test / Medium Tests (Server) (push) Has been cancelled
Test / End-to-End Tests (Server & CLI) (push) Has been cancelled
Test / End-to-End Tests (Web) (push) Has been cancelled
Test / End-to-End Tests Success (push) Has been cancelled
Test / Unit Test Mobile (push) Has been cancelled
Test / Unit Test ML (push) Has been cancelled
Test / .github Files Formatting (push) Has been cancelled

The lints are regrouped and sorted. Also, added the following new lints:
- unnecessary_ignore
- parameter_assignments
- avoid_unused_constructor_parameters
- tighten_type_of_initializing_formals
- only_throw_errors
- deprecated_consistency
- unnecessary_statements

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2026-08-15 16:55:45 +05:30 committed by GitHub
parent bd55f7e73a
commit ffc83eae36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 112 additions and 137 deletions

View file

@ -128,8 +128,8 @@ class PhotoViewGallery extends StatefulWidget {
/// The builder must return a [PhotoViewGalleryPageOptions].
const PhotoViewGallery.builder({
super.key,
required this.itemCount,
required this.builder,
required int this.itemCount,
required PhotoViewGalleryBuilder this.builder,
this.loadingBuilder,
this.backgroundDecoration,
this.wantKeepAlive = false,
@ -145,9 +145,7 @@ class PhotoViewGallery extends StatefulWidget {
this.customSize,
this.allowImplicitScrolling = false,
this.enablePanAlways = false,
}) : pageOptions = null,
assert(itemCount != null),
assert(builder != null);
}) : pageOptions = null;
/// A list of options to describe the items in the gallery
final List<PhotoViewGalleryPageOptions>? pageOptions;
@ -352,9 +350,9 @@ class _PhotoViewGalleryState extends State<PhotoViewGallery> {
/// The [maxScale], [minScale] and [initialScale] options may be [double] or a [PhotoViewComputedScale] constant
///
class PhotoViewGalleryPageOptions {
PhotoViewGalleryPageOptions({
const PhotoViewGalleryPageOptions({
this.key,
required this.imageProvider,
required ImageProvider this.imageProvider,
this.heroAttributes,
this.semanticLabel,
this.minScale,
@ -379,8 +377,7 @@ class PhotoViewGalleryPageOptions {
this.disableGestures,
this.errorBuilder,
}) : child = null,
childSize = null,
assert(imageProvider != null);
childSize = null;
const PhotoViewGalleryPageOptions.customChild({
this.key,

View file

@ -121,7 +121,6 @@ class PhotoViewGestureRecognizer extends ScaleGestureRecognizer {
super.debugOwner,
this.validateAxis,
this.touchSlopFactor = 1,
PointerDeviceKind? kind,
this.disableScaleGestures = false,
}) : super(supportedDevices: null);
final HitCornersDetector? hitDetector;

View file

@ -32,12 +32,10 @@ class ScaleBoundaries {
double get minScale {
assert(_minScale is double || _minScale is PhotoViewComputedScale);
if (_minScale == PhotoViewComputedScale.contained) {
return _scaleForContained(outerSize, childSize) *
(_minScale as PhotoViewComputedScale).multiplier; // ignore: avoid_as
return _scaleForContained(outerSize, childSize) * (_minScale as PhotoViewComputedScale).multiplier;
}
if (_minScale == PhotoViewComputedScale.covered) {
return _scaleForCovering(outerSize, childSize) *
(_minScale as PhotoViewComputedScale).multiplier; // ignore: avoid_as
return _scaleForCovering(outerSize, childSize) * (_minScale as PhotoViewComputedScale).multiplier;
}
assert(_minScale >= 0.0);
return _minScale;
@ -46,16 +44,16 @@ class ScaleBoundaries {
double get maxScale {
assert(_maxScale is double || _maxScale is PhotoViewComputedScale);
if (_maxScale == PhotoViewComputedScale.contained) {
return (_scaleForContained(outerSize, childSize) *
(_maxScale as PhotoViewComputedScale) // ignore: avoid_as
.multiplier)
.clamp(minScale, double.infinity);
return (_scaleForContained(outerSize, childSize) * (_maxScale as PhotoViewComputedScale).multiplier).clamp(
minScale,
double.infinity,
);
}
if (_maxScale == PhotoViewComputedScale.covered) {
return (_scaleForCovering(outerSize, childSize) *
(_maxScale as PhotoViewComputedScale) // ignore: avoid_as
.multiplier)
.clamp(minScale, double.infinity);
return (_scaleForCovering(outerSize, childSize) * (_maxScale as PhotoViewComputedScale).multiplier).clamp(
minScale,
double.infinity,
);
}
return _maxScale.clamp(minScale, double.infinity);
}
@ -63,14 +61,10 @@ class ScaleBoundaries {
double get initialScale {
assert(_initialScale is double || _initialScale is PhotoViewComputedScale);
if (_initialScale == PhotoViewComputedScale.contained) {
return _scaleForContained(outerSize, childSize) *
(_initialScale as PhotoViewComputedScale) // ignore: avoid_as
.multiplier;
return _scaleForContained(outerSize, childSize) * (_initialScale as PhotoViewComputedScale).multiplier;
}
if (_initialScale == PhotoViewComputedScale.covered) {
return _scaleForCovering(outerSize, childSize) *
(_initialScale as PhotoViewComputedScale) // ignore: avoid_as
.multiplier;
return _scaleForCovering(outerSize, childSize) * (_initialScale as PhotoViewComputedScale).multiplier;
}
return _initialScale.clamp(minScale, maxScale);
}