osaxma · GitHub

Describe the bug

Assume we've this on a.dart file:

import 'dart:async';
abstract class Base {
  FutureOr<String> method() => '';
}

And on b.dart file we are trying to overide Base.method:

import 'a.dart';
class BaseImpl extends Base {
  // <~~ typing the word `method` here does not show autocomplete suggestions 
} 

i.e.:

Screen Shot 2022-08-23 at 11 19 03 PM

Though, if we import dart:async in b.dart, the autocomplete for override works.

Screen Shot 2022-08-23 at 11 19 18 PM

The same issue would occur if the non-imported type is an argument of the method instead of a return type.

Expected Behavior:

I would expect the autocomplete to show up, and once it's selected, it'll import all the necessary libraries (i.e. dart:async in this case)


Please complete the following information:

  • VS Code version: Version: 1.70.1
  • Dart extension version: v3.46.1
  • Dart/Flutter SDK version: Dart SDK version: 2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "macos_x64"

Read the original on github.com ↗