Error installing flutter_typeahead package in flutter

Issue

I am pretty new to flutter and trying to install this package flutter_typeahead 1.8.7.
Even after running flutter pub get, I get the following error when trying to use it in my code. Please let me know where I can start diagnosing.

Compiler message:
Error: Could not resolve the package 'flutter_typeahead' in 'package:flutter_typeahead/flutter_typeahead.dart'.
lib/screens/home_screen.dart:10:8: Error: Not found: 'package:flutter_typeahead/flutter_typeahead.dart'
import 'package:flutter_typeahead/flutter_typeahead.dart';
       ^
lib/screens/home_screen.dart:171:22: Error: The method 'TypeAheadField' isn't defined for the class '_HomeScreenState'.
 - '_HomeScreenState' is from 'package:Arriv/screens/home_screen.dart' ('lib/screens/home_screen.dart').
Try correcting the name to the name of an existing method, or defining a method named 'TypeAheadField'.
              child: TypeAheadField(
                     ^^^^^^^^^^^^^^

Solution

I just stopped my running app and re-run it on the emulator. The error was gone.
I was too much addicted to the Hot reloading that I could not even think of this option for sometime. 😛

Answered By – Faizyy

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *