search_helper 0.0.2
search_helper: ^0.0.2 copied to clipboard
A new Flutter package.
Overview #
SearchHelper is code wrapper for searching functionality developed by DotCoder. It is kind of help to developer to perform search on local list.
How it work's #
SearchHelper is class that has two static methods.
1- wordSearch()
2- stringInstantSearch()
both of the methods expect same Parameter to be passed.
| Parameter | Description |
|---|---|
| data | This parameter takes List<Map<String,dynamic>> as a data source and perform search on that data. |
| keys | This parameter takes List<String> as a searching field like search work in title, description field. |
| searchWord | This parameter is basically the word that need to be searched in the data. |
Note:
SearchWord parameter takes dynamic value like it accepts bool, int, double and String.
How wordSearch() and stringInstantSearch() works: #
It takes List<Map<String,dynamic>> as data parameter, List<String> as keys parameter and searchWord parameter takes dynamic value. It returns List<Map<String,dynamic>> as a search result.
Getting Started #
In pubspec.yaml
dependencies:
search_helper: ^0.0.2
Code Example #
import 'package:search_helper/search_helper.dart';
void main(){
List<Map<String,dynamic>> items = [
{
'name': "Osama",
'age': 21,
'father': "Noushad"
},
{
'name': "Haseeb",
'age': 20,
'father': "Noushad"
},
{
'name': "Shahrok",
'age': 22,
'father': "Noushad"
},
{
'name': "Asad",
'age': 23,
'father': "Noushad"
},
];
List<String> keys = ['age','name','father'];
List<Map<String,dynamic>> result = SearchResult.stringInstantSearch(data: items,keys: keys,searchWord: 'osama');
}