Skip to content

Cannot inline async into a function that does not return a Future. it returns FutureOr #59953

Open
@stephane-archer

Description

Image Image Image
class LutFoldersNotifier extends AsyncNotifier<LutFoldersState> {
  @override
  FutureOr<LutFoldersState> build() {
    return _initialize();
  }

  static Future<LutFoldersState> _initialize() async {
    var persistentLutFoldersSet = PersistentLutFoldersSet();
    List<Directory> defaultLutFolders = await _getDefaultLutFolders();
    List<Directory> previoulyImportedLutFolders =
        await _getPrevioulyImportedLutFolders(persistentLutFoldersSet);
    var updatedLutFolders = ISet({
      ...defaultLutFolders.map((e) {
        return e.path;
      }),
      ...previoulyImportedLutFolders.map((e) {
        return e.path;
      })
    });
    var updatedDirectoryTrees = DirectoryTree.create(updatedLutFolders.toSet());
    var updatedState = LutFoldersState(
      updatedLutFolders,
      persistentLutFoldersSet,
      updatedDirectoryTrees,
      true,
    );
    return updatedState;
  }
}

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestanalyzer-refactoringanalyzer-serverarea-analyzerUse area-analyzer for Dart analyzer issues, including the analysis server and code completion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions