PersonalDataProvider class
This provider handles all the data related to the profiles.
Its fields are
editingMode is true when the current profile is been edited and false when a new profile is been created
profileCounter keeps the count of the profiles in the app
activeUser is the position in the list profilesList of the currently selected user
profilesList a list with all the profiles in the app
tempUser an instance of Profile used to save the data in the NewProfileScreen before assigning it to a user in profilesList
dataController to handle the birth date selection
nicknameController to handle the nickname textfield
- Inheritance
-
- Object
- ChangeNotifier
- PersonalDataProvider
Constructors
Properties
- activeUser ↔ int?
-
getter/setter pair
- dataController ↔ TextEditingController
-
getter/setter pair
- editingMode ↔ bool
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- nicknameController ↔ TextEditingController
-
getter/setter pair
- profileCounter ↔ int
-
getter/setter pair
-
profilesList
↔ List<
Profile> -
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tempUser ↔ Profile
-
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addNewProfile(
Profile newUser) → void -
Adds the argument
newUserto profilesList, increments by 1 the profileCounter and calls notifyListeners -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
loadProfiles(
) → Future< void> - Loads the profilesList from SharedPreferences. This function is called every time the app is launched
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetDataController(
) → void - Resets dataController by instancing a new TextEditingController and calls notifyListeners
-
resetNicknameController(
) → void - Resets nicknameController by instancing a new TextEditingController and calls notifyListeners
-
resetProfilesProvider(
) → void - Resets the profilesList by assigning it an empty list and calls notifyListeners
-
resetTempUser(
) → void - Resets tempUser by instancing a new Profile and calls notifyListeners
-
saveProfiles(
) → Future< void> - Saves the profilesList in SharedPreferences so it can be loaded after closing the app
-
setActiveUser(
int? a) → void -
Assigns the argument
ato activeUser and calls notifyListeners -
setEditingMode(
bool e) → void -
Assigns the argument
eto editingMode and calls notifyListeners -
setTempIsSymbols1(
bool b) → void -
Assigns the argument
bto the Profile.isSymbols1 of tempUser and calls notifyListeners -
setTempLevelOfStudies(
String l) → void -
Assigns the argument
lto the Profile.levelOfStudies of tempUser and calls notifyListeners -
setTempNickname(
String n) → void -
Assigns the argument
nto the Profile.nickname of tempUser and calls notifyListeners -
setTempSex(
String s) → void -
Assigns the argument
sto the Profile.sex of tempUser and calls notifyListeners -
toString(
) → String -
A string representation of this object.
inherited
-
updateProfile(
int index, Profile u) → void -
Receives a profile
uand saves it in theindexposition of profilesList and calls notifyListeners
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited