main function
Main entrypoint of the application.
This function is called when the application starts. It initializes the Rust library, sets up the application widget, and shows the window.
The function first calls the RustLib.init function to initialize the
Rust library. Then, it runs the application using the runApp function
with the MyApp widget. If the application is running on Windows, Linux,
or macOS, it sets up the window properties such as the minimum size,
initial size, alignment, and title. Finally, it shows the window.
Implementation
Future<void> main() async {
// Initialize the Rust library
await RustLib.init();
// Set up the application widget
runApp(const MyApp());
// Set up the window properties if running on Windows, Linux, or macOS
if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
doWhenWindowReady(() {
final win = appWindow;
// Set the minimum size of the window
const initialSize = Size(720, 512);
win.minSize = initialSize;
// Set the initial size of the window
win.size = initialSize;
// Set the alignment of the window
win.alignment = Alignment.center;
// Set the title of the window
win.title = 'Caesar Test Demo';
// Show the window
win.show();
});
}
}