Skip to content
Snippets Groups Projects

Class methods

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Manuel Zani
    main.dart 467 B
    void main(){
        final erik = User(nickname: 'Amogus', age: 3, height: 3.47);
        erik.sayHi();
        //erik.printUser(erik);
        User.printUser(erik);
    }
    
    class User{
        User({required this.nickname, required this.age, this.height=2});
        final String nickname;
        final int age;
        final double height;
        
        sayHi(){
          print("Hi");
        }
      
        static printUser(User u){
          print("Nickname: ${u.nickname} | Age: ${u.age} | Height: ${u.height}");
        }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment