Created
August 17, 2020 16:25
-
-
Save AdamMusa/0c4e519a66bc6a2b33b5da49a6f2bd49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:cloudinary_client/cloudinary_client.dart'; | |
import 'package:cloudinary_client/models/CloudinaryResponse.dart'; | |
import 'package:flutter/foundation.dart' ; | |
class CloudImage with ChangeNotifier{ | |
dynamic _response; | |
List<String> _urlList; | |
bool _isloading = true ; | |
dynamic get urlList => _urlList; | |
String get response => _response; | |
bool get isloading => _isloading; | |
Future<void> upload(List<String> imagesList) async{ | |
CloudinaryClient client = new CloudinaryClient( | |
"your apiKey", | |
"your apiSecret", | |
"your cloudName", | |
); | |
List<CloudinaryResponse> response = await client.uploadImages(imagesList,filename: "MawCars"); | |
_response = response; | |
notifyListeners(); | |
if(_response==null){ | |
return null; | |
} | |
else { | |
List<String> urlList= []; | |
_response.forEach((element){ | |
urlList.add(element.secure_url); | |
}); | |
_urlList = urlList; | |
_isloading = false; | |
notifyListeners(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment