Advertisement
amonnoris

v2ray_config.dart

Oct 5th, 2024
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.78 KB | Source Code | 0 0
  1. // lib/models/v2ray_config.dart
  2.  
  3. import 'dart:convert';
  4.  
  5. class V2RayConfig {
  6.   final String name;
  7.   final String configText;
  8.   final String remark;
  9.  
  10.   V2RayConfig({
  11.     required this.name,
  12.     required this.configText,
  13.     required this.remark,
  14.   });
  15.  
  16.   Map<String, dynamic> toJson() => {
  17.         'name': name,
  18.         'configText': configText,
  19.         'remark': remark,
  20.       };
  21.  
  22.   factory V2RayConfig.fromJson(Map<String, dynamic> json) {
  23.     return V2RayConfig(
  24.       name: json['name'],
  25.       configText: json['configText'],
  26.       remark: json['remark'],
  27.     );
  28.   }
  29.  
  30.   // For encoding/decoding to/from JSON strings
  31.   String encode() => jsonEncode(toJson());
  32.  
  33.   static V2RayConfig decode(String jsonString) =>
  34.       V2RayConfig.fromJson(jsonDecode(jsonString));
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement