mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-20 23:22:07 +00:00
Set currentId as local variable
This commit is contained in:
parent
ff96c3c358
commit
4a5ac9aa8a
2 changed files with 6 additions and 4 deletions
|
|
@ -8,7 +8,7 @@ import 'package:mangayomi/utils/reg_exp_matcher.dart';
|
|||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
part 'crop_borders_provider.g.dart';
|
||||
|
||||
int currentId = 0;
|
||||
int nextId = 0;
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
Future<Uint8List?> cropBorders(CropBordersRef ref,
|
||||
|
|
@ -32,6 +32,8 @@ Future<Uint8List?> cropBorders(CropBordersRef ref,
|
|||
return null;
|
||||
}
|
||||
|
||||
final currentId = nextId;
|
||||
nextId++;
|
||||
final completer = Completer<Uint8List>();
|
||||
CropBordersInput(
|
||||
interactionId: currentId,
|
||||
|
|
@ -44,7 +46,6 @@ Future<Uint8List?> cropBorders(CropBordersRef ref,
|
|||
});
|
||||
final image = await completer.future;
|
||||
subscription.cancel();
|
||||
currentId++;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import 'package:mangayomi/messages/boa_js.pb.dart';
|
||||
import 'dart:async';
|
||||
|
||||
int currentId = 0;
|
||||
int nextId = 0;
|
||||
|
||||
Future<String> evalJs(String script) async {
|
||||
final currentId = nextId;
|
||||
nextId++;
|
||||
final completer = Completer<String>();
|
||||
BoaInput(
|
||||
interactionId: currentId,
|
||||
|
|
@ -17,7 +19,6 @@ Future<String> evalJs(String script) async {
|
|||
});
|
||||
final response = await completer.future;
|
||||
subscription.cancel();
|
||||
currentId++;
|
||||
|
||||
return response;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue