Search
 
SCRIPT & CODE EXAMPLE
 

DART

get file size flutter

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

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 :: dart absolute value 
Dart :: dart switch 
Dart :: How can I add shadow to the widget in flutter? 
Dart :: raisedbutton shape flutter 
Dart :: close current page flutter 
Dart :: check if isempty TextEditingController flutter 
Dart :: flutter listtile minverticalpadding 
Dart :: dart string empty or null 
Dart :: flutter lock orientation for page 
Dart :: flutter snackbar width 
Dart :: flutter chip padding 
Dart :: dart map foreach 
Dart :: dart integer division 
Dart :: replace string in dart,replace string in dart using regex 
Dart :: flutter tooltip height 
Dart :: text field validation in flutter 
Dart :: flutter capture image from camera 
Dart :: dart empty check 
Dart :: how do you change the back button flutter 
Dart :: check if string contain number dart flutter 
Dart :: how to add cards in flutter 
Dart :: dart getter 
Dart :: consumer flutter 
Dart :: flutter transform translate 
Dart :: flutter call phone number 
Dart :: position of item in array dart 
Dart :: flutter scroll to end of list 
Dart :: spacer in singlechildscrollview 
Dart :: card in flutter 
Dart :: flutter run ios white screen 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =