intEmpty function
时间选择器 默认 时间设置
var s = PDuration.now(); print('longer1 >>> ${s.toString()}'); {year: 2021, month: 1, day: 5, hour: 17, minute: 17, second: 3}
var m = PDuration(year: 2011);
print('longer2 >>> ${m.toString()}');
{year: 2011, month: 0, day: 0, hour: 0, minute: 0, second: 0}
var d = PDuration.parse(DateTime.parse('20200304'));
print('longer3 >>> ${d.toString()}');
{year: 2020, month: 3, day: 4, hour: 0, minute: 0, second: 0}
Implementation
bool intEmpty(int? value) {
return (value == null || value == 0);
}