forked from eatvio/eatvio_app
review: fixed review issues
This commit is contained in:
@@ -199,11 +199,17 @@ class CreateDietCubit extends Cubit<CreateDietState> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const int _maxImageBytesForBase64 = 5 * 1024 * 1024;
|
||||
|
||||
Future<Diet?> getDietForPreview() async {
|
||||
if (!_isFormValidForDraft()) return null;
|
||||
final authorProfile = await profileRepository.getMyProfile();
|
||||
final imageBytes = (await state.dietData.image?.readAsBytes()) ?? <int>[];
|
||||
String image = base64.encode(imageBytes);
|
||||
String image = '';
|
||||
if (imageBytes.isNotEmpty && imageBytes.length <= _maxImageBytesForBase64) {
|
||||
image = base64.encode(imageBytes);
|
||||
}
|
||||
if (image.isEmpty && state.dietData.imageUrl != null) {
|
||||
image = state.dietData.imageUrl ?? '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user