I have a method called Counter() In the homepage StatefullWidget, i want to call this method from my main.dart.
I am trying to call the method Counter() from my main.dart file. i post the code below
here is my homepage, class
import 'package:flutter/material.dart';
class homepage extends StatefulWidget {
const homepage({Key? key}) : super(key: key);
@override
_homepageState createState() => _homepageState();
}
class _homepageState extends State<homepage> {
@override
Widget build(BuildContext context) {
return Container();
}
Counter(){
//I want to call this method from my main.dart file
}
}
Here is my main.dart file
import 'package:flutter/material.dart';
Future<void> backgroundhandller(RemoteMessage message) async {
**Counter()** //I want to call here
}
void main() async {
FirebaseMessaging.onBackgroundMessage(backgroundhandller);
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
title: "Taxiyee_Messaging_app",
home: LoginScreen(),
));
}