weekdayName static method

String weekdayName(
  1. int weekday, {
  2. bool short = true,
})

Returns the Chinese weekday name for weekday (1 = Monday, 7 = Sunday).

If short is true, returns a single character; otherwise a two-character label.

Implementation

static String weekdayName(int weekday, {bool short = true}) {
  const shortNames = ['一', '二', '三', '四', '五', '六', '日'];
  const longNames = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
  final index = (weekday - 1) % 7;
  return short ? shortNames[index] : longNames[index];
}