mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-25 00:00:26 +08:00
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:
@ -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';
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'dart:io';
|
||||
import 'dart:io' show Platform, Directory;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
Reference in New Issue
Block a user