Skip to content

Instantly share code, notes, and snippets.

import 'dart:io';
import 'package:ai38re/model/product_model.dart';
import 'package:ai38re/viewmodel/image_view_model.dart';
import 'package:ai38re/viewmodel/product_view_model.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
import 'package:ai38re/repo/image_repo.dart';
import 'package:flutter/material.dart';
class ImageViewModel extends ChangeNotifier {
final ImageRepo _imageRepo;
ImageViewModel({required ImageRepo imageRepo}) : _imageRepo = imageRepo;
bool _loading = false;
import 'package:ai38re/repo/image_repo.dart';
import 'package:cloudinary_public/cloudinary_public.dart';
class ImageRepoImpl implements ImageRepo {
final cloudinary = CloudinaryPublic(
"dvztiygb9", // replace with yours cloud name
"projects", // replace with yours unsigned present
cache: false,
);
package com.example.c38.view
import android.app.Activity
import android.net.Uri
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.scaleOut
package com.example.c38.utils
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.provider.MediaStore
import android.util.Log
import androidx.activity.result.ActivityResultLauncher
package com.example.c37b.viewmodel
import android.content.Context
import android.net.Uri
import androidx.lifecycle.ViewModel
import com.example.c37b.repository.CommonRepository
class ImageViewModel(val repo: ImageRepo) : ViewModel() {
fun uploadImage(
package com.example.c38.repository
import android.content.Context
import android.database.Cursor
import android.net.Uri
import android.os.Handler
import android.os.Looper
import android.provider.OpenableColumns
import com.cloudinary.Cloudinary
import com.cloudinary.utils.ObjectUtils
@Sprajapati123
Sprajapati123 / ImageRepo.kt
Last active June 18, 2026 05:42
ImageRepo.kt
package com.example.c38.repository
import android.content.Context
import android.net.Uri
interface ImageRepo {
fun uploadImage(
context: Context,
imageUri: Uri,
package com.example.c38re.view
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
package com.example.ai37c
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performTextInput
import androidx.test.espresso.Espresso.onView
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Before
import org.junit.Rule