Last active
July 2, 2020 15:02
-
-
Save JoeCodeswell/cfded55df52dd2bb37228d12c7ef049c to your computer and use it in GitHub Desktop.
DartPad Dart List initialization
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
// on dartpad: https://dartpad.dev/cfded55df52dd2bb37228d12c7ef049c | |
void main() { | |
Co co = Co(); | |
print(co.getTag1()); //Out: profitable | |
print(co.getMgr1().fn); //Out: null | |
} | |
class Co { | |
List<String> _tags = ['profitable', '1999', 'public', 'NYSE']; | |
String getTag1() { | |
return _tags.first; | |
} | |
List<Mgr> _mgrs = List.from([ | |
Mgr( | |
fn: 'Janice', | |
ln: 'Brown', | |
), | |
Mgr( | |
fn: 'Laura', | |
ln: 'Lopez', | |
), | |
Mgr( | |
fn: 'Linda', | |
ln: 'Oakley', | |
), | |
], growable: false); | |
Mgr getMgr1(){ | |
return _mgrs.first; | |
} | |
} | |
class Mgr { | |
String fn; | |
String ln; | |
Mgr({String fn, String ln}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment