Remove a few more cases of dart:io usage

I want to abstract out all uses of File and Directory. The sooner I can
do that the sooner I can use it on the web.
This commit is contained in:
Vishesh Handa
2021-07-23 00:42:28 +02:00
parent 0099d09ae4
commit 0ea8da0d44
5 changed files with 6 additions and 8 deletions

View File

@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:io' show HttpHeaders;
import 'package:flutter/foundation.dart' as foundation;
import 'package:flutter/services.dart';

View File

@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:io' show HttpHeaders;
import 'dart:math';
import 'package:flutter/foundation.dart' as foundation;

View File

@ -513,7 +513,8 @@ class Note with NotesNotifier {
}
}
Future<void> addImageSync(File file) async {
Future<void> addImageSync(String filePath) async {
var file = File(filePath);
var absImagePath = _buildImagePath(file);
file.copySync(absImagePath);

View File

@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -127,8 +125,7 @@ class NoteEditorState extends State<NoteEditor> with WidgetsBindingObserver {
if (existingImages.isNotEmpty) {
for (var imagePath in existingImages) {
try {
var file = File(imagePath);
note!.addImageSync(file);
note!.addImageSync(imagePath);
} catch (e, st) {
Log.e("New Note Existing Image", ex: e, stacktrace: st);
}

View File

@ -1,4 +1,4 @@
import 'dart:io';
import 'dart:io' show Platform, Directory;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';