Skip to content

Commit 5da7da9

Browse files
committed
Use proper references in comments, where possible
1 parent e5c351a commit 5da7da9

20 files changed

Lines changed: 28 additions & 25 deletions

analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ linter:
6666
camel_case_types: false
6767
cancel_subscriptions: true
6868
cast_nullable_to_non_nullable: false # to be changed
69+
comment_references: true
6970
constant_identifier_names: false
7071
control_flow_in_finally: true
7172
deprecated_consistency: true

lib/helpers/locale.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ Locale? resolveLocale(List<Locale>? locales, Iterable<Locale> supportedLocales)
3636
}
3737

3838
/// Stable string encoding for a [Locale], matching the keys generated by
39-
/// Flutter's AppLocalizations (e.g. `pt_BR`, `zh_Hant`, `pl`). [scriptCode]
40-
/// takes precedence over [countryCode] so locales like `zh_Hant` round-trip
39+
/// Flutter's AppLocalizations (e.g. `pt_BR`, `zh_Hant`, `pl`).
40+
/// [Locale.scriptCode] takes precedence over [Locale.countryCode] so locales
41+
/// like `zh_Hant` round-trip
4142
/// distinctly from plain `zh`.
4243
String encodeLocale(Locale locale) {
4344
final script = locale.scriptCode;

lib/helpers/shared_preferences.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PreferenceHelper {
2323
/// SharedPreferences is migrated to SharedPreferencesAsync. This migration
2424
/// only happens once, as checked by the migrationCompletedKey.
2525
///
26-
/// [migrationCompletedKey] is used to track if the migration has been
26+
/// `migrationCompletedKey` is used to track if the migration has been
2727
/// completed.
2828
Future<void> migrationSupportFunctionForSharedPreferences() async {
2929
const SharedPreferencesOptions sharedPreferencesOptions = SharedPreferencesOptions();

lib/powersync/api_client.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ApiClient {
4343

4444
/// Fetches a short-lived PowerSync JWT and its endpoint URL from the
4545
/// wger backend. The `Authorization` header for this request is set
46-
/// by the underlying [AuthHttpClient] based on the current auth state.
46+
/// by the underlying `AuthHttpClient` based on the current auth state.
4747
Future<Map<String, dynamic>> getPowersyncToken() async {
4848
final response = await _client.get(
4949
Uri.parse('$serverUrl/api/v2/powersync-token'),

lib/powersync/connector.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class DjangoConnector extends PowerSyncBackendConnector {
125125

126126
/// Transform a record before sending it to the backend.
127127
///
128-
/// Note that PowerSync hands us [op.opData] as native SQLite primitives only
128+
/// Note that PowerSync hands us `op.opData` as native SQLite primitives only
129129
/// (`null`, `int`, `double`, `String`, `Uint8List`).
130130
///
131131
/// * inject the row [id] (PowerSync stores it separately from the

lib/providers/auth_credential.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import 'package:wger/helpers/jwt.dart';
2121

2222
part 'auth_credential.freezed.dart';
2323

24-
/// Sealed credential carried inside [AuthState] for every authenticated
24+
/// Sealed credential carried inside `AuthState` for every authenticated
2525
/// caller. Branch via `switch` or `is` to access the variant-specific
2626
/// fields; the two getters below cover everything the HTTP layer needs.
2727
///

lib/providers/auth_http_client.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ const refreshLeeway = Duration(seconds: 30);
4040
/// within [refreshLeeway] of now.
4141
/// - On a 401 reply for a *replayable* [http.Request] body that was sent
4242
/// with a JWT, refresh once and retry. If the retry also returns 401
43-
/// the session is treated as genuinely revoked: [onSessionExpired]
43+
/// the session is treated as genuinely revoked: `onSessionExpired`
4444
/// runs (clear credentials + surface a snackbar) and a synthetic 401
4545
/// is returned to the caller. Non-replayable bodies (multipart /
4646
/// streamed) are not retried; the pre-emptive refresh in the happy
4747
/// path is the primary safeguard.
4848
///
4949
/// Wrapped behind [authenticatedHttpClientProvider] so consumers
50-
/// ([WgerBaseProvider], PowerSync's connector) get the auth handling for
50+
/// (`WgerBaseProvider`, PowerSync's connector) get the auth handling for
5151
/// free without needing to know about the migration state.
5252
class AuthHttpClient extends http.BaseClient {
5353
final http.Client _inner;

lib/providers/auth_notifier.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ class AuthNotifier extends _$AuthNotifier {
402402
}
403403

404404
/// Re-runs the auto-login flow. Used by the recovery screens
405-
/// ([ServerUnreachableScreen], [PowerSyncUnreachableScreen]) so the user
405+
/// (`ServerUnreachableScreen`, `PowerSyncUnreachableScreen`) so the user
406406
/// can retry without restarting the app.
407407
Future<void> retryAutoLogin() async {
408408
state = const AsyncLoading();
@@ -857,7 +857,8 @@ class AuthNotifier extends _$AuthNotifier {
857857
}
858858

859859
/// User-driven logout. Always wipes credentials; the local PowerSync data is
860-
/// kept by default and only wiped when the user opts out ([keepDataOnLogout]).
860+
/// kept by default and only wiped when the user opts out
861+
/// ([AuthCredentialsStorage.keepDataOnLogout]).
861862
/// Keeping it lets the same user sign back in and resume the sync
862863
/// incrementally instead of re-downloading everything; the DB-owner marker is
863864
/// preserved so a *different* user signing in still triggers a wipe.
@@ -939,7 +940,7 @@ class AuthNotifier extends _$AuthNotifier {
939940
}
940941

941942
/// Removes the local PowerSync data whether or not the DB has been built:
942-
/// when the instance exists we use PowerSync's own [disconnectAndClear],
943+
/// when the instance exists we use PowerSync's own `disconnectAndClear`,
943944
/// otherwise (cold start, before any data widget has built it) we delete
944945
/// the on-disk files directly so no data survives.
945946
///

lib/providers/exercise_filter_state.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import 'package:wger/models/exercises/exercise.dart';
2323
/// UI state for the exercise list screen: the current filter
2424
/// configuration plus the resulting [filteredExercises]. The raw
2525
/// equipment / categories lists are not kept here, consumers that
26-
/// need them should watch [exerciseEquipmentProvider] /
27-
/// [exerciseCategoriesProvider] directly.
26+
/// need them should watch `exerciseEquipmentProvider` /
27+
/// `exerciseCategoriesProvider` directly.
2828
class ExerciseFilterState {
2929
final List<Exercise> exercises;
3030
final List<Exercise> filteredExercises;

lib/providers/exercise_filters_notifier.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ part 'exercise_filters_notifier.g.dart';
2929

3030
/// Holds the *UI-side* state for the exercises catalogue screen:
3131
/// search term, selected categories/equipment, and the resulting
32-
/// [filteredExercises] list.
32+
/// [ExerciseFilterState.filteredExercises] list.
3333
@Riverpod(keepAlive: true)
3434
class ExerciseListFiltersNotifier extends _$ExerciseListFiltersNotifier {
3535
final _logger = Logger('ExerciseListFiltersNotifier');

0 commit comments

Comments
 (0)