getArrowMatch function

RegExpMatch? getArrowMatch(
  1. String typeString
)

Match the typeString with the regex Example: 'Vec

Example:

final match = getVecMatch('Vec<u8>');
print(match); // ['Vec<u8>', 'Vec', 'u8']

Example:

final match = getVecMatch('Vec<(u8, u8)>');
print(match); // ['Vec<(u8, u8)>', 'Vec', '(u8, u8)']

Example:

final match = getVecMatch('Vec<(u8, Vec<u8>)>');
print(match); // ['Vec<(u8, Vec<u8>)>', 'Vec', '(u8, Vec<u8>)']

Implementation

RegExpMatch? getArrowMatch(String typeString) {
  return RegExp(r'^([^<]*)<(.+)>$').firstMatch(typeString);
}