Created
June 3, 2020 03:39
-
-
Save instance-id/b42b8a85c31429e3fffb38be0a111165 to your computer and use it in GitHub Desktop.
Extending User class with additional fields. I don't know if this is the proper way to do it, though?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:firedart/auth/user_gateway.dart'; | |
class FBUserData{ | |
String _fname; | |
String _lname; | |
String _serialNum; | |
String _contactEmail; | |
String _verified; | |
} | |
extension FBUser on User{ | |
static FBUserData user = FBUserData(); | |
String get fname => user._fname; | |
String get lname => user._lname; | |
String get serialNum => user._serialNum; | |
String get contactEmail => user._contactEmail; | |
dynamic get verified => getBool(user._verified); | |
bool getBool(String value) { | |
return (user._verified != null) ? user._verified.toLowerCase() == 'true' : false; | |
} | |
set fname(String value) { | |
user._fname = value; | |
} | |
set lname(String value) { | |
user._lname = value; | |
} | |
set serialNum(String value) { | |
user._serialNum = value; | |
} | |
set contactEmail(String value) { | |
user._contactEmail = value; | |
} | |
set verified(String value) { | |
user._verified = value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment