Created
October 14, 2019 09:36
-
-
Save minikin/5d9c3fcc316bb4021a4d5b82a395ef67 to your computer and use it in GitHub Desktop.
Extension in Dart
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:flutter/foundation.dart'; | |
class User extends Object { | |
final String userId; | |
final String firstName; | |
final String secondName; | |
bool isActive; | |
User({ | |
@required this.userId, | |
@required this.firstName, | |
@required this.secondName, | |
@required this.isActive, | |
}); | |
} | |
extension UserExtention on User { | |
static bool toggle() { | |
return this.isActive = !this.isActive; | |
} | |
} | |
final User = User(userId: '1', firstName: 'John', secondName: 'Doe', isActive: true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment