패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.3.2

simple_s3

Android 및 iOS에서 어떤 파일도 업로드하고 삭제할 수 있는 고급이지만 사용하기 쉬운 AWS S3 플러그인입니다.

AndroidiOS
30일 다운로드
108
좋아요
41
Pub 점수
140

패키지 설치

flutter pub add simple_s3

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

simple_s3는 Android 및 iOS에서 AWS S3에 파일을 업로드하고 삭제하는 작업을 단순화하는 Flutter 플러그인입니다. 사용 편의성을 중심으로 설계되어, 복잡한 AWS SDK 상호작용을 간단한 메서드로 추상화하여 개발자가 깊은 AWS 지식 없이도 파일 저장소를 관리할 수 있도록 합니다. 이 패키지는 어떤 파일 유형이나 클라우드 기반 파일 처리가 필요한 모바일 앱에 원활하게 통합될 수 있으며, AWS의 안전한 인증 메커니즘을 활용하면서도 가볍고 개발자 친화적인 API를 유지합니다.

사용 사례

  • AWS S3에 이미지 및 문서 업로드
  • S3 버킷에서 파일 삭제
  • 모바일 앱에 클라우드 스토리지 통합하기
  • 사용자 생성 콘텐츠 저장 처리
  • 백업 및 동기화 기능 사용

주요 기능

  • 간단한 업로드 및 삭제 API
  • 모든 파일 형식 지원
  • 안전한 AWS S3 통합
  • 크로스 플랫폼 호환성 (Android 및 iOS)
  • 최소한의 설정 및 구성

적합한 대상

  • AWS S3를 사용하는 모바일 앱 개발자
  • 파일 업로드/삭제 기능이 필요한 프로젝트
  • 안전한 클라우드 파일 관리가 필요한 앱
  • 경량 S3 솔루션을 찾는 개발자

고려 사항

  • AWS 자격 증명과 적절한 버킷 정책이 필요합니다
  • Android 및 iOS 플랫폼에 한정
  • 외부 AWS SDK 동작에 의존
  • 내장 파일 목록 또는 메타데이터 관리 없음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

simple_s3

An advance yet simple to use AWS S3 plugin for upload and deletion.

Simple S3 uses AWS Native SDKs for iOS and Android

Getting started

Add dependency in pubspec.yaml

simple_s3: 0.3.2

Follow @ab_hi_j on Twitter

Features

Feature Description
Null Safe :white_check_mark:
Upload Percentage :white_check_mark:
Supports all files SimpleS3 auto detects content type of file by looking into extension
Set Access Type Allows you to set access type of file ex. PublicRead, Private etc
Default is Public Read
Timestamp Turned off by default if turned on allows you to append timestamp in file name.
Location of timestamp can be changed to either prefix or suffix
Default is prefix
Custom File Name Allows to change name of file about to upload.
Note : File name must contain extension.
Custom S3 folder path Allows to upload file to specific folder in S3
Sub Region Support Allows upload/delete operations on S3 having sub regions
Delete Object Allows deletion of file object
Auto Generates URL URL pointing to S3 file is auto generated.


Not working in Android Release mode ?

If your Android app is not working in release mode please check this section


Usage Examples

Simple File Upload

// returns url pointing to S3 file

SimpleS3 _simpleS3 = SimpleS3();
String result = await _simpleS3.uploadFile(
				file, <--------------- Selected File
				bucketName, <--------- Your Bucket Name
				poolID, <------------- Your POOL ID
				AWSRegions.apSouth1 <- S3 server region
				);

Delete

// returns bool

bool result = await SimpleS3.delete(
				filePath, <---------------- S3 File Path
				bucketName, <-------------- Your Bucket Name
				poolID, <------------------ Your POOL ID
				AWSRegions.apSouth1, <----- S3 server region
				);

// delete also supports sub-regions

File Upload with Percentage

// returns url pointing to S3 file

SimpleS3 _simpleS3 = SimpleS3();
//Upload function
String result = await _simpleS3.uploadFile(
				file, <--------------- Selected File
				bucketName, <--------- Your Bucket Name
				poolID, <------------- Your POOL ID
				AWSRegions.apSouth1 <- S3 server region
				);

//Widget
child: StreamBuilder<dynamic>(  
    stream: _simpleS3.getUploadPercentage,  
    builder: (context, snapshot) {  
      return new Text(  
        snapshot.data != null ? "Uploaded: ${snapshot.data}" : "Simple S3",  
    );  
  }),

Custom File Name

// returns url pointing to S3 file

SimpleS3 _simpleS3 = SimpleS3();
String result = await _simpleS3.uploadFile(
				file, <------------------------------ Selected File
				bucketName, <------------------------ Your Bucket Name
				poolID, <---------------------------- Your POOL ID
				AWSRegions.apSouth1, <--------------- S3 server region
				fileName: "Dennis_ritchie.jpeg", <--- Custom file name
				);

Custom S3 Path

// returns url pointing to S3 file

SimpleS3 _simpleS3 = SimpleS3();
String result = await _simpleS3.uploadFile(
				file, <-------------------------------- Selected File
				bucketName, <--------------------------- Your Bucket Name
				poolID, <------------------------------- Your POOL ID
				AWSRegions.apSouth1, <------------------ S3 server region
				s3FolderPath: "users/profile_pics", <--- Custom S3 path
				);

// final path will be  "bucketName/users/profile_pics"

Setting Access Control

// returns url pointing to S3 file

SimpleS3 _simpleS3 = SimpleS3();
String result = await _simpleS3.uploadFile(
				file, <------------------------------------- Selected File
				bucketName, <------------------------------- Your Bucket Name
				poolID, <----------------------------------- Your POOL ID
				AWSRegions.apSouth1, <---------------------- S3 server region
				accessControl: S3AccessControl.private, <--- Setting access of uploaded file **private**
				);

// S3AccessControl have more types of AccessControl ex. .publicRead, .publicReadWrite etc...

Using Timestamp

// returns url pointing to S3 file

SimpleS3 _simpleS3 = SimpleS3();
String result = await _simpleS3.uploadFile(
				file, <------------------------------------- Selected File
				bucketName, <------------------------------- Your Bucket Name
				poolID, <----------------------------------- Your POOL ID
				AWSRegions.apSouth1, <---------------------- S3 server region
				useTimeStamp: true, <----------------------- Enable Timestamp
				);

// default location of timestamp is prefix
// if original file name = "Dennis_ritchie.jpeg"
// then the result will be = "1591705658_Dennis_ritchie.jpeg"


// Change Timestamp Location



SimpleS3 _simpleS3 = SimpleS3();
String result = await _simpleS3.uploadFile(
				file, <--------------------------------------- Selected File
				bucketName, <--------------------------------- Your Bucket Name
				poolID, <------------------------------------- Your POOL ID
				AWSRegions.apSouth1, <------------------------ S3 server region
				useTimeStamp: true, <------------------------- Enable Timestamp
				timeStampLocation: TimestampLocation.suffix,<- Changes timestamp location to suffix
				);
// if original file name = "Dennis_ritchie.jpeg"
// then the result will be = "Dennis_ritchie_1591705658.jpeg"

Using Sub-Region

// returns url pointing to S3 file

SimpleS3 _simpleS3 = SimpleS3();
String result = await _simpleS3.uploadFile(
				file, <------------------------------------- Selected File
				bucketName, <------------------------------- Your Bucket Name
				poolID, <----------------------------------- Your POOL ID
				AWSRegions.apSouth1, <---------------------- S3 server region
				subRegion: AWSRegions.apNorthEast1 <-------- Sub region
				);

Debug mode

// for security reasons plugin uses less logs, to enable full logs -

SimpleS3 _simpleS3 = SimpleS3();
String result = await _simpleS3.uploadFile(
				file, <--------------- Selected File
				bucketName, <--------- Your Bucket Name
				poolID, <------------- Your POOL ID
				AWSRegions.apSouth1 <- S3 server region
				debugLog: true, <----- Enable full logs
				);

Android Proguard settings for release mode


// add these lines in your app/build.gradle

		minifyEnabled true  
		useProguard true  
		proguardFiles getDefaultProguardFile('proguard-android.txt'),  
		        'proguard-aws-2.1.5.pro'

//EXAMPLE
		buildTypes {  
		  release {  
		  signingConfig signingConfigs.release  
		  minifyEnabled true  
		  useProguard true  
		  proguardFiles getDefaultProguardFile('proguard-android.txt'),  
		                'proguard-aws-2.1.5.pro'  
		  }  
		}

Now copy contents of this file proguard-aws-2.1.5.pro Create a new file with name "proguard-aws-2.1.5.pro" at the same location as app/build.gradle and paste the copied contents into this file.

Your release mode APK should work now.

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.