I am trying to call a dart method which is in another dart file from main. dart. For some reason the method seems to inaccessible. Here I am trying to access the _configureAmplify method which is in another class. I got all the import added correctly. What am I doing wrong? Here is my main.dart class -
class _AmplifyFlutterState extends State<AmplifyFlutter> {
bool _amplifyConfigured = false;
void initState() {
super.initState();
Authentication._configureAmplify().then((result) {
if (result) {
setState(() {
_amplifyConfigured = true;
Navigator.push(context, MaterialPageRoute(builder: (_) => SignUpScreen()));
});
} else {
_amplifyConfigured = false;
}
});
}
}
Here is the other class which defines the _configureAmplify method
class Authentication {
Future<bool> _configureAmplify() async {
bool _amplifyConfigured = false;
Amplify.addPlugin(AmplifyAuthCognito());
try {
await Amplify.configure(amplifyconfig);
}
on AmplifyAlreadyConfiguredException {
print("Amplify was already configured. Was the app restarted?");
} catch(e) {
print(e);
}
return _amplifyConfigured;
}
}
