-
-
Notifications
You must be signed in to change notification settings - Fork 971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Riverpod doesn't rebuild its widget correctly on MacOS when we start using other app windows. #3878
Comments
I have no issue here. Any change you could make a minimal reproducible example? It could be that your app is the issue |
Here is the code for reproducing the issue. just drop folder to the app. import 'dart:async';
import 'package:desktop_drop/desktop_drop.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
void main() {
runApp(const ProviderScope(child: MyApp()));
}
final favoriteFoldersProvider = StateProvider<int>(
(ref) => 0,
);
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends ConsumerWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final favoriteFolders = ref.watch(favoriteFoldersProvider);
return Scaffold(
appBar: AppBar(),
body: DropTarget(
onDragDone: (dropDoneDetails) async {
await _processDroppedFiles(
dropDoneDetails,
ref,
);
},
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(favoriteFolders.toString()),
],
),
),
),
);
}
static Future<void> _processDroppedFiles(
DropDoneDetails dropDoneDetails,
WidgetRef ref,
) async {
var files = dropDoneDetails.files;
final filePaths = files.map((e) {
return e.path;
});
if (filePaths.isEmpty) {
return;
}
var favoriteFolders = ref.read(favoriteFoldersProvider.notifier);
for (var i = 0; i < filePaths.length; i++) {
favoriteFolders.update((state) {
return state + 1;
});
}
}
}
|
That's too much code. Any change you could reproduce that with a simple counter? |
@rrousselGit I can still observe this behavior with a simple counter. Can you reproduce this on your side? |
Riverpod doesn't rebuild its widget correctly on MacOS when we start using other app windows.
output.mov
The text was updated successfully, but these errors were encountered: