mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
String to Uint8List function
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:typed_data';
|
||||||
|
import 'dart:convert';
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
import 'package:apidash/models/models.dart' show KVRow;
|
import 'package:apidash/models/models.dart' show KVRow;
|
||||||
|
|
||||||
@ -77,3 +79,13 @@ List<KVRow>? mapToRows(Map<String, String>? kvMap) {
|
|||||||
}
|
}
|
||||||
return finalRows;
|
return finalRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint8List? stringToBytes(String? text) {
|
||||||
|
if (text == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
var l = utf8.encode(text);
|
||||||
|
var bytes = Uint8List.fromList(l);
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user