Horje
dart enum from string Code Example
Dart enum to string
enum Topic { none, computing, general }

extension TopicString on String {
  Topic get topic {
    switch (this) {
      case 'computing':
        return Topic.computing;
      case 'general':
        return Topic.general;
      case 'none':
        return Topic.none;
    }
  }
}

extension TopicExtension on Topic {
  String get string {
    switch (this) {
      case Topic.computing:
        return 'computing';
      case Topic.general:
        return 'general';
      case Topic.none:
        return 'none';
    }
  }
}
dart enum from string
Fruit f = Fruit.values.firstWhere((e) => e.toString() == 'Fruit.' + str);




Whatever

Related
ffmpeg scale and saturation Code Example ffmpeg scale and saturation Code Example
oldest roblox account Code Example oldest roblox account Code Example
photoshop script create folder Code Example photoshop script create folder Code Example
bootstrap content alignment Code Example bootstrap content alignment Code Example
'flutter/flutter.h' file not found Code Example 'flutter/flutter.h' file not found Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7