generateWindowsCode function
Future<bool>
generateWindowsCode({
- required DesktopSplashConfig config,
- required String flavor,
- required Directory outputDir,
Generates Windows platform-specific code for the native splash screen
Takes a config
object containing splash screen configuration,
a flavor
string to support multiple build flavors,
and an output path
to override the default location.
Returns true
if generation was successful, false
otherwise.
Implementation
Future<bool> generateWindowsCode({
required DesktopSplashConfig config,
required String flavor,
required Directory outputDir,
}) async {
// Validate image file exists
final imageFile = File(config.imagePath);
if (!imageFile.existsSync()) {
logger.e('Image file not found: ${config.imagePath}');
return false;
}
// Load and process the image
final BGRAImage? imageData = await _loadAndProcessImage(config);
if (imageData == null) {
return false;
}
// Generate the C++ source file
return _generateSourceFile(
outputDir: outputDir.path,
flavor: flavor,
config: config,
imageData: imageData,
);
}