You can write a file with just that function, like:
test.dart
void launchWebView () {
print("1234");
}
and then import that file like this:
main.dart
import "test.dart";
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
launchWebView();
It is not really clean, but you can do that.
Alternatively you can use a class with a static method like:
class test {
static void foo() {
print("1234");
}
}
and then in your code invoke it like that (after the import):
test.foo();