rrousselGit / riverpod

A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
https://riverpod.dev
MIT License
6.23k stars 954 forks source link

Automatically add `import` when converting to `ConsumerWidget` or `ConsumerStatefulWidget` #3777

Open minhqdao opened 3 days ago

minhqdao commented 3 days ago

I wish import 'package:flutter_riverpod/flutter_riverpod.dart'; would be automatically added to my Dart file when I'm converting a StatelessWidget or StatefulWidget to a ConsumerWidget or ConsumerStatefulWidget and the package import isn't already present.

Currently it's a two-step procedure: 1) Convert a StatelessWidget or a StatefulWidget to a ConsumerWidget or ConsumerStatefulWidget, followed by 2) Add the import statement. The conversion works even without the import statement. I think the process could be more seamless by automating the second step that everyone has to do anyways.

I'm using VSCode on macOS.

rrousselGit commented 3 days ago

Good idea.