content_copy
dashboard

#dart #flutter

String capitalize(String s) {
  if (s == null || s.isEmpty) {
    return s;
  }
  return s.length < 1 ? s.toUpperCase() : s[0].toUpperCase() + s.substring(1);
}
content_copy
dashboard

#dart #flutter

bool _isNumeric(String str) {
  if(str == null) {
    return false;
  }
  return double.tryParse(str) != null;
}
content_copy
dashboard

#dart #flutter

final imagesBytes = {};
for (Asset a in images) {
  final bytes = await a.requestOriginal();
  imagesBytes[a.identifier] = bytes.buffer.asUint8List();
}
final imagesData = images.map((a) => UploadFileInfo.fromBytes(imagesBytes[a.identifier], a.name)).toList();
final response = await Dio().post('myapi/uploadImage.php',
  data: FormData.from({
    'images[]': imagesData,
}));
keyboard_arrow_up