autocomplete_textfield 1.3.0

  • Example
  • Installing
  • Versions
  • 87


An autocomplete textfield for flutter

Pub Package Can Be Found At

Pub Package


AutoCompleteTextField supports any data type suggestions

new AutoCompleteTextField<YOURDATATYPE>()

The suggestions parameter must have data that matches <YOURDATATYPE>

A global key of type GlobalKey<AutoCompleteTextFieldState<T>> is required so that the clear() method can be called to clear AutoCompleteTextField.

Strings and itemFilter

Filtering is case sensitive so when using strings a common implementation of itemFilter is .
itemFilter: (item, query) { return item.toLowerCase().startsWith(query.toLowerCase()); }


Works great published version 1


import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Auto Complete TextField Demo',
      theme: new ThemeData(
      home: new MyHomePage(),

class MyHomePage extends StatefulWidget {
  _MyHomePageState createState() => new _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  List<String> added = [];
  String currentText = "";
  GlobalKey<AutoCompleteTextFieldState<String>> key = new GlobalKey();

  Widget build(BuildContext context) {
    var textField = new AutoCompleteTextField<String>(
        decoration: new InputDecoration(
            hintText: "Search Item",
            border: new OutlineInputBorder(
                gapPadding: 0.0, borderRadius: new BorderRadius.circular(16.0)),
            suffixIcon: new Icon(,
        key: key,
        suggestions: [
          "Ice Cream",
          "Kiwi Fruit",
          "Palm Oil",
          "T-Bone Steak",
          "Urid Dal",
        textChanged: (item) {
          currentText = item;
        itemBuilder: (context, item) {
          return new Padding(
              padding: EdgeInsets.all(8.0), child: new Text(item));
        itemSorter: (a, b) {
          return a.compareTo(b);
        itemFilter: (item, query) {
          return item.toLowerCase().startsWith(query.toLowerCase());

    Column body = new Column(children: [
      new ListTile(
          title: textField,
          trailing: new IconButton(
              icon: new Icon(Icons.add),
              onPressed: () {
                setState(() {

    body.children.addAll( {
      return new ListTile(title: new Text(item));

    return new Scaffold(
        appBar: new AppBar(title: new Text('Auto Complete TextField Demo')),
        body: body);

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  autocomplete_textfield: ^1.3.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:autocomplete_textfield/autocomplete_textfield.dart';
Version Uploaded Documentation Archive
1.3.0 Sep 2, 2018 Go to the documentation of autocomplete_textfield 1.3.0 Download autocomplete_textfield 1.3.0 archive
1.2.1 Aug 6, 2018 Go to the documentation of autocomplete_textfield 1.2.1 Download autocomplete_textfield 1.2.1 archive
1.2.0 Jul 14, 2018 Go to the documentation of autocomplete_textfield 1.2.0 Download autocomplete_textfield 1.2.0 archive
1.1.0 Jul 14, 2018 Go to the documentation of autocomplete_textfield 1.1.0 Download autocomplete_textfield 1.1.0 archive
1.0.0 Jul 14, 2018 Go to the documentation of autocomplete_textfield 1.0.0 Download autocomplete_textfield 1.0.0 archive
0.0.2 Jul 14, 2018 Go to the documentation of autocomplete_textfield 0.0.2 Download autocomplete_textfield 0.0.2 archive
0.0.1 Jul 14, 2018 Go to the documentation of autocomplete_textfield 0.0.1 Download autocomplete_textfield 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Fix lib/autocomplete_textfield.dart.

Analysis of lib/autocomplete_textfield.dart reported 1 hint:

line 12 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies