Skip to content

Instantly share code, notes, and snippets.

@r3dm1ke
Created December 3, 2019 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r3dm1ke/bab1a732f69985cc010c4fd2649a9884 to your computer and use it in GitHub Desktop.
Save r3dm1ke/bab1a732f69985cc010c4fd2649a9884 to your computer and use it in GitHub Desktop.
A Task class for TODO application in Flutter
class Task {
// Class properties
// Underscore makes them private
String _name;
bool _completed;
// Default constructor
// this syntax means that it will accept a value and set it to this.name
Task(this._name);
// Getter and setter for name
getName() => this._name;
setName(name) => this._name = name;
// Getter and setter for completed
isCompleted() => this._completed;
setCompleted(completed) => this._completed = completed;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment