flutter_ipfs 0.0.2 flutter_ipfs: ^0.0.2 copied to clipboard
A Flutter package that helps you to upload image, video or file to IPFS in a single click.
A Flutter package that lets anyone to upload any image, video or a file to IPFS with a single click of button with just a simple line of code.
Features #
• Pick and Upload Image to IPFS • Pick and Upload Video to IPFS • Pick and Upload File to IPFS
Getting started #
TODO: List prerequisites and provide or point to information on how to start using the package.
Installation #
In the dependencies: section of your pubspec.yaml, add the following line:
dependencies:
flutter_ipfs: <latest_version>
Update the ext.kotlin_version to latest version , here '1.6.10' is latest in the android/build.gradle of your project.
buildscript {
ext.kotlin_version = '1.6.10' // Update the kotlin version to latest
}
Update the compileSdkVersion, minSdkVersion and targetSdkVersion as given below in the code snippet.
android {
compileSdkVersion 31 // Update the compile SDK version
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
minSdkVersion 24 // Update the min SDK version
targetSdkVersion 31 // Update the target SDK version
}
}
<manifest ... >
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application ...>
Usage #
import 'package:flutter/material.dart';
import 'package:flutter_ipfs/src/service/image_picker.dart';
class MYAPP extends StatelessWidget {
const MYAPP({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
child: RaisedButton(
onPressed: () => ImagePickerService.pickImage(context),
color: Colors.black,
textColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
child: const SizedBox(
height: 50,
child: Center(
child: Text(
'Upload Image',
style: TextStyle(fontSize: 18, fontFamily: 'Brand-Bold'),
),
),
),
),
);
}
}
Additional information #
The upload image can be seen by using the cid which will be printed in the console URL : https://ipfs.io/ipfs/ + cid as paste it to your browser it will directly direct it to your file which you have uploaded to the ipfs.