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

unqualified_reference_to_non_local_static_member on static const member #967

Closed
kzrnm opened this issue Aug 18, 2023 · 1 comment
Closed
Assignees
Labels
bug Something isn't working needs triage

Comments

@kzrnm
Copy link

kzrnm commented Aug 18, 2023

Describe the bug

Generator create uncompilable file. unqualified_reference_to_non_local_static_member occurred on static const member.

To Reproduce

Use static const as @Default argument.

todo.dart

import 'package:freezed_annotation/freezed_annotation.dart';

part 'todo.freezed.dart';

@freezed
class Todo with _$Todo {
  const Todo._();

  const factory Todo({
    @Default(defaultValue) int num,
  }) = _Todo;

  static const defaultValue = 20;
}

todo.freezed.dart

class _$_Todo extends _Todo {
  const _$_Todo({this.num = defaultValue}) : super._();

Expected behavior

todo.freezed.dart

class _$_Todo extends _Todo {
  const _$_Todo({this.num = Todo.defaultValue}) : super._();
@kzrnm kzrnm added bug Something isn't working needs triage labels Aug 18, 2023
@kzrnm kzrnm changed the title Raise unqualified_reference_to_non_local_static_member on static const member unqualified_reference_to_non_local_static_member on static const member Aug 18, 2023
@rrousselGit
Copy link
Owner

Duplicate of #123

@rrousselGit rrousselGit marked this as a duplicate of #123 Aug 18, 2023
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

2 participants