phase3: nullfix.py batch script — bang/late/param-nullable
Automated null-safety fixes driven by dart analyze (no corruption): - unchecked_use_of_nullable_value: insert '!' on receiver (property/method/[]/op) - not_initialized field/var: mark 'late' - missing_default_value_for_parameter: nullable param Errors: 2374(peak) -> 907
This commit is contained in:
@@ -199,8 +199,8 @@ class Util {
|
||||
return box;
|
||||
}
|
||||
|
||||
static Widget showImage(String imageUrl, {double width, double height,
|
||||
BoxFit fit, Widget Function(BuildContext, String, dynamic) errorWidget}) {
|
||||
static Widget showImage(String imageUrl, {double? width, double? height,
|
||||
BoxFit? fit, Widget Function(BuildContext, String, dynamic)? errorWidget}) {
|
||||
if (imageUrl != null && imageUrl.isNotEmpty && imageUrl.startsWith('https:')) {
|
||||
return CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
@@ -317,14 +317,14 @@ class Util {
|
||||
final picker = ImagePicker();
|
||||
var image = await picker.pickImage(source: ImageSource.gallery);
|
||||
Navigator.of(context).pop();
|
||||
uploadPicture(context, File(image.path), user, commentId: commentId, orderId: orderId);
|
||||
uploadPicture(context, File(image!.path), user, commentId: commentId, orderId: orderId);
|
||||
}
|
||||
|
||||
void getPictureFromCamera(BuildContext context, User user, {int commentId = -1, int orderId = 0}) async {
|
||||
final picker = ImagePicker();
|
||||
var image = await picker.pickImage(source: ImageSource.camera);
|
||||
Navigator.of(context).pop();
|
||||
uploadPicture(context, File(image.path), user, commentId: commentId, orderId: orderId);
|
||||
uploadPicture(context, File(image!.path), user, commentId: commentId, orderId: orderId);
|
||||
}
|
||||
|
||||
void uploadPicture(BuildContext context, File image, User user, {int commentId = -1, int orderId = 0}) async {
|
||||
@@ -454,18 +454,18 @@ class Util {
|
||||
ImagePicker picker = ImagePicker();
|
||||
var image = await picker.pickImage(source: ImageSource.gallery);
|
||||
Navigator.of(context).pop();
|
||||
onGotFile(imageId, image.path);
|
||||
onGotFile(imageId, image!.path);
|
||||
}
|
||||
|
||||
void getPictureFromCamera2(BuildContext context, int imageId, OnGotFile onGotFile) async {
|
||||
ImagePicker picker = ImagePicker();
|
||||
var image = await picker.pickImage(source: ImageSource.camera);
|
||||
Navigator.of(context).pop();
|
||||
onGotFile(imageId, image.path);
|
||||
onGotFile(imageId, image!.path);
|
||||
}
|
||||
|
||||
Future<void> createTicket(BuildContext context, String msg, List<Map<String, dynamic>> images,
|
||||
OnSuccess onSuccess, OnError onError, {int id}) {
|
||||
OnSuccess onSuccess, OnError onError, {int? id}) {
|
||||
var formData = FormData();
|
||||
formData.fields.add(MapEntry("msg", msg));
|
||||
formData.fields.add(MapEntry('id', id == null ? '0' : id.toString()));
|
||||
@@ -555,6 +555,6 @@ class Util {
|
||||
ByteData data = await rootBundle.load(path);
|
||||
ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
|
||||
ui.FrameInfo fi = await codec.getNextFrame();
|
||||
return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List();
|
||||
return (await fi.image.toByteData(format: ui.ImageByteFormat.png))!.buffer.asUint8List();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user