Reputation:
Here is my code
ElevatedButton(
child : Text ("Continue"),
onPressed: () {
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
KeyboardUtil.hideKeyboard(context);
Navigator.pushNamed(context, LoginSuccessScreen.routeName);
}
},
),
ElevatedButton
isn't a function. (Documentation) Try correcting the name to match an existing function, or define a method or function named 'ElevatedButton'.
The name ElevatedButton
is defined in the libraries package:fitnessapp/components/elevated_button.dart
and package:flutter/src/material/elevated_button.dart (via package:flutter/material.dart)
. (Documentation) Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.
"How i can fix this problem" ?
Upvotes: 2
Views: 253
Reputation: 1500
In the dart file you use, there are 2 imported files that have the same name, so it does not know which to use. Either remove one of them or name the libraries:
import 'package:fitnessapp/components/elevated_button.dart' as MyButton;
Then whenever you want to use something from this file, you can call it like:
MyButton.ElevatedButton()
;
Upvotes: 2