Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifiers should not have public properties/getters. Instead, all their public API should be exposed through the state property. #3128

Closed
hcanyz opened this issue Nov 17, 2023 · 2 comments
Assignees
Labels
bug Something isn't working needs triage

Comments

@hcanyz
Copy link

hcanyz commented Nov 17, 2023

Describe the bug
I got a warning when creating the Provider.

image

To Reproduce

import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'main.g.dart';

@riverpod
class LintTest extends _$LintTest {
  @override
  String build() => "";

  String get get => state; // warning 

  String method() => state;
}

Expected behavior

get only uses state, which is reasonable and requires no warning, just like method.

@hcanyz hcanyz added bug Something isn't working needs triage labels Nov 17, 2023
@rrousselGit
Copy link
Owner

Nope it isn't :)

No public getter/properties

@sharpsan
Copy link

sharpsan commented Jun 3, 2024

Would you mind elaborating on why getters are not reasonable? Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

3 participants