This commit is contained in:
2025-02-12 14:21:40 +02:00
parent b384d91ecb
commit bccde3fe9f
3 changed files with 45 additions and 5 deletions

View File

@@ -2,9 +2,49 @@ include: package:lints/recommended.yaml
linter:
rules:
# ==== Project Organization Rules ====
# Enforces relative imports to maintain project structure and avoid unnecessary long paths
- prefer_relative_imports
- close_sinks
- avoid_empty_else
# Ensures that files are named in lowercase_with_underscores format
- file_names
# ==== Best Practices ====
# Enforces the closing of streams and sinks to avoid memory leaks
- close_sinks
# Avoids empty 'else' blocks to reduce confusion and improve code readability
- avoid_empty_else
# Prefer using 'const' constructors wherever possible for better performance and immutability
- prefer_const_constructors
# Avoid leading underscores for local variable names to prevent conflicts and improve clarity
- no_leading_underscores_for_local_identifiers
# ==== Code Consistency ====
# Avoids the use of 'print' statements in production code, encouraging proper logging instead
- avoid_print
# Encourages using 'final' for fields that are not reassigned to promote immutability
- prefer_final_fields
# Ensures that all types are explicitly specified for better readability and type safety
- always_specify_types
# Ensures constructors are at the top of the class for better readability and consistency
- sort_constructors_first
# Avoids redundant default argument values to keep the code clean
- avoid_redundant_argument_values
# Enforces consistency by preferring single quotes over double quotes for string literals
- prefer_single_quotes
# ==== Documentation Rules ====
# Enforces documentation for all public classes, methods, and fields to improve API clarity
# - public_member_api_docs
# ==== Null Safety ====
# Avoids unnecessary null checks and encourages the use of null-aware operators
- unnecessary_null_checks

View File

@@ -1,4 +1,4 @@
import "package:flutter/painting.dart";
import 'package:flutter/painting.dart';
extension BorderExtension on BorderDirectional {
BorderDirectional all(BorderSide side) {

View File

@@ -1,6 +1,6 @@
extension ListExtension<E> on List<E> {
bool containsAll(List<E> otherList) {
List<bool> checks = [];
List<bool> checks = <bool>[];
//
for (E thisElement in otherList) {
checks.add(contains(thisElement));
@@ -9,7 +9,7 @@ extension ListExtension<E> on List<E> {
}
List<E> getUnique() {
List<E> uniqueItems = [];
List<E> uniqueItems = <E>[];
for (E thisElement in this) {
if (!uniqueItems.contains(thisElement)) {
uniqueItems.add(thisElement);