title: Basic Flutter Class accessibility
body: <p>Basic Issue: Need to access Class throughout flutter application.</p>
  
  <p>Requirements: Do not want this to be a stateful widget that i access.</p>
  
  <p>Simply want a class that I can access by importing on other pages. I am persisting a user login with a set of variables, and I don't want to have to push this object from page to page. </p>
  
  <p>Would like to simply access the class values </p>
  
  <p>I was unable to find any good example for this using a singleton or other solutions that gave me what I was looking for.</p>
  
  <pre><code>import 'package:myApp/models/user.dart';
  
  MyClass.Username = "testUser"; //Set the username
  
  String currentUser = MyClass.Username; // Get the username
  
  //Here is the top of the User class - is this creating a class that will 
  //only be defined once in the app, so if I set a value it will persist ?
  class User {
  
  static User _user = new User._internal();
  
  factory User() {
    return _user;
  }
  
  User._internal();
  //More stuff
  ....}
  </code></pre>