flutter / flutter/flutter-intellij
Prioritize creating 'final' variables in 'Introduce Variable' refactoring
- Dominant language
- Java
- Stars
- 2k
- Forks
- 356
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 27
Description
The 'Introduce Variable' feature currently creates a `var` instead of a `final` variable. It should prioritize `final` when the variable is not reassigned.
**Current Behavior:**
Starting with:
```dart
await Something.initialize(
resourceAttributes: {
'service.environment': config.environment,
}.toAttributes(),
);
```
Using 'Introduce Variable' results in:
```dart
var attributes = {
'service.environment': config.environment,
}.toAttributes();
await Something.initialize(
resourceAttributes: attributes,
);
```
**Desired Behavior:**
It should generate:
```dart
final attributes = {
'service.environment': config.environment,
}.toAttributes();
await Something.initialize(
resourceAttributes: attributes,
);
```
Contributor guide
Assessment
This issue has not been assessed yet.