fromText static method
- String text
Create one from text representation
Implementation
static Card? fromText(String text) {
var match = _oneCard.firstMatch(text);
if (match == null) return null;
if (match.group(1) != null) {
switch (match.group(1)) {
case "Jk":
return Joker;
case "Jb":
return BlackJoker;
case "Jw":
return WhiteJoker;
default:
if (match.group(2) != null && match.group(3) != null) {
var r = Rank.fromChar(match.group(2)!);
var s = Suit.fromChar(match.group(3)!);
assert(r != null && s != null);
return fromRankSuit(r!, s!);
}
}
}
return null;
}