danahartweg / flutter_bloc_list_manager

Extension to flutter_bloc that handles the underlying logic to filter and search list view data dynamically.
https://medium.com/flutter-community/building-a-package-to-manage-lists-with-flutter-bloc-7197e2dd7811
MIT License
15 stars 1 forks source link

Error: Could not find the correct Provider<SearchQueryCubit> above this BlocBuilder<SearchQueryCubit, String> Widget #22

Closed sath26 closed 2 years ago

sath26 commented 3 years ago

no any modifiction to code but couldnt figure out how to solve this

sath26 commented 3 years ago
class SearchInput extends StatelessWidget {
  @override
  Widget build(_) {
    return BlocBuilder<SearchQueryBloc, String>(
      builder: (context, state) {
        return Flexible(
          child: TextField(
            decoration: const InputDecoration(
              icon: Icon(Icons.search),
              labelText: 'Search',
            ),
            textInputAction: TextInputAction.search,
            onChanged: (value) =>
                context.bloc<SearchQueryBloc>().add(SetSearchQuery(value)),
          ),
        );
      },
    );
  }
}

the example doesnt have change in searchinput function from searchquerycubit to searchquerybloc. it is so because the flutter package thats get pulled doesnt have searchquerycubit. instead searchquerybloc has been used. above is the code to make the necessary change in onChanged attribute.

danahartweg commented 2 years ago

As of https://github.com/danahartweg/flutter_bloc_list_manager/releases/tag/v0.3.1 both the package implementation and documentation should completely reference SearchQueryCubit instead of SearchQueryBloc. Which I don't think is really what you're seeing, but I wanted to mention it.

Not being able to find the correct provider will usually mean that there isn't a ListManager in the tree above the SearchInput you're trying to render.

I know this was submitted a long time ago (apologies for the delay), but are you still having issues?

sath26 commented 2 years ago

nope.. no more issues.. thank you for the reponse but most importantly thank u for the update of the package...

danahartweg commented 2 years ago

Awesome! Glad it's all sorted.