https://github.com/devs-group/flutter_insta_share
Instagram Share Plugin
https://github.com/devs-group/flutter_insta_share
Last synced: about 1 year ago
JSON representation
Instagram Share Plugin
- Host: GitHub
- URL: https://github.com/devs-group/flutter_insta_share
- Owner: devs-group
- License: bsd-2-clause
- Created: 2020-05-02T19:22:44.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-29T18:12:18.000Z (almost 6 years ago)
- Last Synced: 2025-02-16T15:20:41.714Z (over 1 year ago)
- Language: Dart
- Size: 3.29 MB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# instashare
Share easily and directly to Instagram.
Inspired and adapted from [attilaroy](https://github.com/attilaroy/share-instagram-swift) (iOS) and [romatroskin](https://github.com/romatroskin/social_share_plugin) (Android)
## Android

You don't need to configure anything for Android.
## iOS

Open your `info.plist` and add
```xml
...
LSApplicationQueriesSchemes
instagram
NSCameraUsageDescription
This app needs to access your camera so you can take and add photos easily into the app.
NSPhotoLibraryUsageDescription
This app needs access to your gallery so you can pick images or share to Instagram.
...
```
> Mind that you can write anything inside the **NSCameraUsageDescription** and **NSPhotoLibraryUsageDescription** \ block. This is just an example text.
## Usage
In your `.dart` file import the library with
```dart
import 'package:instashare/instashare.dart';
```
then call the method with (eg.)
```dart
Future sharePost(File file) {
int result = await Instashare.shareToFeedInstagram("image/*", file.path);
if (result != InstashareStatus.Done.index) {
throw (result);
}
}
```
as you can see i added multiple result integers as an return value.
You can check the result against those:
```dart
- InstashareStatus.Done (equals to 0)
// Successful sharing
- InstashareStatus.WriteFileError (equals to 1)
// Writing the file did not work (iOS only)
- InstashareStatus.WritePhotoAlbumError (equals to 2)
// Writing the file to Photo Album did not work (iOS only)
- InstashareStatus.InstagramNotInstalledError (equals to 3)
// Instagram is not installed (or at least is not recognized)
- InstashareStatus.AccessingPhotosError (equals to 4)
// User did not allow to access photo library (iOS only)
```
> Mind: Always use the `.index` function like `InstashareStatus.Done.index` to compare against the result.
## Example
You can also simply use my example app and check out the code.
1. Open your emulator or connect your device
2. `cd example`
3. `flutter run -t lib/main.dart --debug`
## Todo
- If possible remember the generated photo (iOS only) in the gallery and delete it when the user comes back into the app.