извините за поздний ответ.Вы добавили ожидание в неправильном месте, к сожалению.Попробуйте что-то вроде этого:
child: RaisedButton(onPressed:() async {
CurrentPrjId= await SaveProject();
print("CurrentPrjId Is saved CurrentPrjId :::::::: " );
print(CurrentPrjId);
Navigator.of(context).pushReplacementNamed('/AllUSerStories');
}
//Save Project
Future SaveProject() async {
//SaveProjectResult has the id of the current created project which i need that for its user stories
var SaveProjectResult = await GetPostProjects().createProject(_ProjectnameController.text, _CustomernameController.text, _dropNewItem, _dropNewItem2, _StartDateController.text, _EndDateController.text,);
print(":::::::::::::::::::::::::::::::The Project Is Created And Here Its ID In SaveProject:::::::::");
print(SaveProjectResult);
return SaveProjectResult;
или короче:
child: RaisedButton(onPressed:() async {
CurrentPrjId= await GetPostProjects().createProject(_ProjectnameController.text, _CustomernameController.text, _dropNewItem, _dropNewItem2, _StartDateController.text, _EndDateController.text,);
print("CurrentPrjId Is saved CurrentPrjId :::::::: " );
print(CurrentPrjId);
Navigator.of(context).pushReplacementNamed('/AllUSerStories');
}