Search
 
SCRIPT & CODE EXAMPLE
 

DART

file picker flutter file size

import 'dart:io';

//Here's the method to get file size:

double getFileSize(File file){      
	int sizeInBytes = file.lengthSync();
	double sizeInMb = sizeInBytes / (1024 * 1024);
    return sizeInMb;
}

//Alternatively for extension:

extension FileUtils on File {
	get size {
    	int sizeInBytes = this.lengthSync();
		double sizeInMb = sizeInBytes / (1024 * 1024);
    	return sizeInMb;
    }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: How to create a small circular dot in FLutter code example 
Dart :: circular elevated button flutter 
Dart :: flutter portrait only 
Dart :: hide debug flag flutter 
Dart :: flutter close dialog 
Dart :: dart parse boolean from string 
Dart :: change font size flutter 
Dart :: flutter button with icon 
Dart :: Flutter turn string to int 
Dart :: android application ic_launcher dimmensions 
Dart :: to disable the shrinker pass the --no-shrink flag to this command. in flutter 
Dart :: flutter animated container 
Dart :: custom error snackbar with icon flutter 
Dart :: flutter firestore crud 
Dart :: linearprogressindicator flutter 
Dart :: dart data class generator 
Dart :: looping through a list dart 
Dart :: sign out from firebase flutter 
Dart :: dart trim 
Dart :: dart try catch 
Dart :: hellow world in dart 
Dart :: double to animation in flutter 
Dart :: flutter int max value 
Dart :: conditionalstatement in widget flutter 
Dart :: generate list flutter 
Dart :: fluter check that date is greater than another date 
Dart :: scroll with mouse in flutter 
Dart :: flutter dart imagepicker quality reduce resize 
Dart :: onbackpressed in flutter 
Dart :: dart regex,regex dart 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =