Skip to content

Instantly share code, notes, and snippets.

@lajunta
Created November 29, 2016 07:38
Show Gist options
  • Save lajunta/c8bf5367fb50b08a8bc5f22ff57b8719 to your computer and use it in GitHub Desktop.
Save lajunta/c8bf5367fb50b08a8bc5f22ff57b8719 to your computer and use it in GitHub Desktop.
class AppConfig{
bool is_login ;
String username;
AppConfig({this.is_login, this.username});
}
class MyApp{
static AppConfig appconfig = new AppConfig(is_login: false, username: "guest");
static updateConfig(AppConfig aconfig){
appconfig = aconfig;
}
}
void main(){
AppConfig bconfig = new AppConfig(username: "张晓亚",is_login: true);
MyApp.updateConfig(bconfig);
print(MyApp.appconfig.is_login);
print(MyApp.appconfig.username);
print(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment