generate method

  1. @override
Widget generate(
  1. Context context
)
override

Implementation

@override
Widget generate(Context context) {
  String getMode() {
    if (mode == null) return '';
    if (mode == ScheduleMode.append) return ' append';
    return ' replace';
  }

  final time = ticks.toString(reduce: context.version > 19.4);

  if (_file != null) {
    return Group(
      prefix: 'schedule',
      children: [_file!],
      suffix: ' $time${getMode()}',
    );
  }
  if (mode == ScheduleMode.clear) {
    return Command('schedule clear ${context.packId}:$_name');
  }

  return Command(
    'schedule function ${context.packId}:$_name $time${getMode()}',
  );
}