Future main()

in tool/icon_generator/lib/main.dart [21:58]


Future main() async {
  // Verify that we're running from the project root.
  if (path.basename(toolsRoot) != 'tools_metadata') {
    print('Script must be run from tool/icon_generator');
    exit(1);
  }

  MyIconApp app = MyIconApp(material.icons, cupertino.icons);
  runApp(app);

  await pumpEventQueue();

  // TODO(devoncarew): Below, we could queue up some or all findAndSave()
  // operations and then wait for all futures to complete (using a Pool?).
  // Assuming we don't get out of memory issues this might finish much faster as
  // there is a decent amount of delay getting data from the gpu for each icon.

  for (material.IconTuple icon in material.icons) {
    await findAndSave(
        icon.smallKey, '$resourcesFolder/material/${icon.name}.png',
        small: true);
    await findAndSave(
        icon.largeKey, '$resourcesFolder/material/${icon.name}@2x.png',
        small: false);
  }

  for (cupertino.IconTuple icon in cupertino.icons) {
    await findAndSave(
        icon.smallKey, '$resourcesFolder/cupertino/${icon.name}.png',
        small: true);
    await findAndSave(
        icon.largeKey, '$resourcesFolder/cupertino/${icon.name}@2x.png',
        small: false);
  }

  print('Finished generating icons, quitting...');
  exit(0);
}