Skip to content

Commit

Permalink
bumped to version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nixrajput committed Aug 12, 2023
1 parent 2b76ff2 commit be104cd
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 719 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.2.0

- **Update**: `LICENSE` changed to MIT.
- **Update**: All dependencies are updated to latest version.
- **Fix**: All known bugs fixed.

## 1.1.3

- **Update**: All dependencies are updated to latest version.
Expand Down
686 changes: 17 additions & 669 deletions LICENSE

Large diffs are not rendered by default.

122 changes: 80 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# cloudinary

A dart package for to integrate [Cloudinary](https://cloudinary.com/) API into your dart and flutter app. This package is a wrapper around the [Cloudinary API](https://cloudinary.com/documentation/image_upload_api_reference).
A dart package for to integrate [Cloudinary](https://cloudinary.com/) API into your dart and flutter
app. This package is a wrapper around
the [Cloudinary API](https://cloudinary.com/documentation/image_upload_api_reference).

[![pub package](https://img.shields.io/pub/v/cloudinary.svg?label=Version)][pub]
[![Stars](https://img.shields.io/github/stars/nixrajput/cloudinary-dart?label=Stars)][repo]
Expand All @@ -19,11 +21,13 @@ A dart package for to integrate [Cloudinary](https://cloudinary.com/) API into y
Add `cloudinary` as a dependency in your `pubspec.yaml` file:

```dart
dependencies:
cloudinary: latest_version
dependencies:cloudinary: "
latest_version
"
```

Finally you just have to run: `dart pub get` **or** `flutter pub get` depending on the project type and this will download the dependency to your pub-cache.
Finally you just have to run: `dart pub get` **or** `flutter pub get` depending on the project type
and this will download the dependency to your pub-cache.

And import it:

Expand Down Expand Up @@ -61,79 +65,103 @@ final cloudinary = Cloudinary.unsignedConfig(
Recommended only for server side apps.

```dart
final response = await cloudinary.upload(
file: file.path,
fileBytes: file.readAsBytesSync(),
resourceType: CloudinaryResourceType.image,
folder: cloudinaryCustomFolder,
fileName: 'some-name',
progressCallback: (count, total) {
print(
'Uploading image from file with progress: $count/$total');
}),
final response = await
cloudinary.upload
(
file: file.path,
fileBytes: file.readAsBytesSync(),
resourceType: CloudinaryResourceType.image,
folder: cloudinaryCustomFolder,
fileName: 'some-name',
progressCallback: (count, total) {
print(
'Uploading image from file with progress: $count/$total');
}),
);
if(response.isSuccessful) {
print('Get your image from with ${response.secureUrl}');
print('Get your image from with ${response.secureUrl}');
}
```

You can upload a file from path or byte array representation, you can also pass an `optParams` map to do a more elaborated upload according to <https://cloudinary.com/documentation/image_upload_api_reference>
The `cloudinary.upload(...)` function is fully documented, you can check the description to know what other options you have.
You can upload a file from path or byte array representation, you can also pass an `optParams` map
to do a more elaborated upload according
to <https://cloudinary.com/documentation/image_upload_api_reference>
The `cloudinary.upload(...)` function is fully documented, you can check the description to know
what other options you have.

### Do a unsigned file upload

Recommended for server client side apps.
The way to do this request is almost the same as above, the only difference is the `uploadPreset` which is required for unsigned uploads.
The way to do this request is almost the same as above, the only difference is the `uploadPreset`
which is required for unsigned uploads.

```dart
final response = await cloudinary.unsignedUpload(
file: file.path,
uploadPreset: somePreset,
fileBytes: file.readAsBytesSync(),
resourceType: CloudinaryResourceType.image,
folder: cloudinaryCustomFolder,
fileName: 'some-name',
progressCallback: (count, total) {
print(
'Uploading image from file with progress: $count/$total');
})
final response = await
cloudinary.unsignedUpload
(
file: file.path,
uploadPreset: somePreset,
fileBytes: file.readAsBytesSync(),
resourceType: CloudinaryResourceType.image,
folder: cloudinaryCustomFolder,
fileName: 'some-name',
progressCallback: (count, total) {
print(
'Uploading image from file with progress: $count/$total');
})
);
if(response.isSuccessful) {
print('Get your image from with ${response.secureUrl}');
print('Get your image from with ${response.secureUrl}');
}
```

You can upload a file from path or byte array representation, you can also pass an `optParams` map to do a more elaborated upload according to <https://cloudinary.com/documentation/image_upload_api_reference>
The `cloudinary.unsignedUpload(...)` function is fully documented, you can check the description to know what other options you have.
You can upload a file from path or byte array representation, you can also pass an `optParams` map
to do a more elaborated upload according
to <https://cloudinary.com/documentation/image_upload_api_reference>
The `cloudinary.unsignedUpload(...)` function is fully documented, you can check the description to
know what other options you have.

### Do a file delete *(this will use the cloudinary destroy method)*

```dart
final response = await cloudinary.destroy('public_id',
url: url,
resourceType: CloudinaryResourceType.image,
invalidate: false,
final response = await
cloudinary.destroy
('public_id
'
,url: url,
resourceType: CloudinaryResourceType.image,
invalidate: false,
);
if(response.isSuccessful ?? false){
//Do something else
//Do something else
}
```

To delete a cloudinary file it´s necessary a `public_id`, as you can see in the sample code the `deleteResource(...)` function can delete a file by it's url...
You can also pass an `optParams` map to do a more elaborated delete *(destroy)* according to <https://cloudinary.com/documentation/image_upload_api_reference#destroy_method>
The `cloudinary.destroy(...)` function is fully documented, you can check the description to know what other options you have.
To delete a cloudinary file it´s necessary a `public_id`, as you can see in the sample code
the `deleteResource(...)` function can delete a file by it's url...
You can also pass an `optParams` map to do a more elaborated delete *(destroy)* according
to <https://cloudinary.com/documentation/image_upload_api_reference#destroy_method>
The `cloudinary.destroy(...)` function is fully documented, you can check the description to know
what other options you have.

## About Cloudinary

Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device.
Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers
to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs.
Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the
viewing device.

## Get Help

If you run into an issue or have a question, you can either:

- Issues related to the SDK: [Open a Github issue](https://github.com/nixrajput/cloudinary-dart/issues).
- Issues related to the
SDK: [Open a Github issue](https://github.com/nixrajput/cloudinary-dart/issues).

## Connect With Me

Expand All @@ -144,13 +172,23 @@ If you run into an issue or have a question, you can either:
[![Facebook: nixrajput07](https://img.shields.io/badge/nixrajput07-141430?logo=Facebook&logoColor=fff)][facebook]

[pub]: https://pub.dev/packages/cloudinary

[github]: https://github.com/nixrajput

[facebook]: https://facebook.com/nixrajput07

[twitter]: https://twitter.com/nixrajput07

[instagram]: https://instagram.com/nixrajput

[linkedin]: https://linkedin.com/in/nixrajput

[releases]: https://github.com/nixrajput/cloudinary-dart/releases

[repo]: https://github.com/nixrajput/cloudinary-dart

[issues]: https://github.com/nixrajput/cloudinary-dart/issues

[license]: https://github.com/nixrajput/cloudinary-dart/blob/master/LICENSE.md

[pulls]: https://github.com/nixrajput/cloudinary-dart/pulls
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ linter:
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_generic_function_type_aliases
- prefer_initializing_formals
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).bottomAppBarColor,
color: Theme.of(context).bottomAppBarTheme.color,
borderRadius: BorderRadius.circular(8.0),
),
padding: const EdgeInsets.all(16.0),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/utils/utility.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class Utility {
onTap: onImageRemove,
child: Container(
padding: const EdgeInsets.all(16),
child: Row(
children: const <Widget>[
child: const Row(
children: <Widget>[
Icon(
Icons.delete,
color: Colors.red,
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cloudinary
description: A dart package to integrate Cloudinary API in Dart and Flutter.

version: 1.1.3
version: 1.2.0

homepage: https://github.com/nixrajput
repository: https://github.com/nixrajput/cloudinary-dart
Expand All @@ -11,10 +11,10 @@ environment:
sdk: ">=2.18.0 <4.0.0"

dependencies:
dio: ^5.2.1
dio: ^5.3.2
crypto: ^3.0.3

dev_dependencies:
flutter_lints: ^2.0.1
test: ^1.24.3
lints: ^2.1.1
test: ^1.24.6
path: ^1.8.3

0 comments on commit be104cd

Please sign in to comment.