0
I’m studying Flutter and recently I’ve had a rather boring problem. I was using Future for my asynchronous programming and I did all the code, just like the example I was seeing. However, I realized that Future was not being recognized, and there was a recommendation for me to do the import
package async
. I did it, but still the problem did not solve.
Future<int> insertAgendamento(Agendamento agendamento) async {
Database db = await this.database;
var resultado = await db.insert(agendaTable, agendamento.toMap());
return resultado;
}
Turns out I’ve already done the import
and put a dependency on pubspec.yaml
.
import 'dart:async';
When I hover over my "Future" the following message appears:
Future isn’t a type. Try correcting the name to match an existing type.
And in that import
, The warning appears that I am not using it... Maybe it is something silly, that for lack of attention, I could not find. But I’d like your help.
Hello! Could you [Edit] your question to include the error message you are receiving? :)
– Luiz Felipe
Hello Luiz! I made the edition you asked for. The error that appears, is in Visual Studio, when I step the mouse over the Future.
– Johnny The Developer
What version of your flutter and Dart?
– Leandro Souza
Leandro, my version of Flutter is (Channel stable, 1.22.6) I updated it recently, because I thought that was the problem. The Dart version is SDK version: 2.10.5 (stable).
– Johnny The Developer