Here are some simple Dart Snippets
Simple 'Hello, World!' style code to test your environment:
Return to the NoFuss Solutions website.
void main() {
print('Hello, Dart!');
}
Obtaining the current date and testing if it is the same day as a given date:
void main() {
var now = DateTime.now();
var sameDay = now.subtract(Duration(hours: 1));
print("The times are the same day: ${isSameDay(now, sameDay)}");
}
isSameDay(DateTime d1, DateTime d2) {
return (d1.day == d2.day && d1.month == d2.month && d1.year == d2.year);
}