You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using a provider with a record type (e.g. typedef ExampleRecord = ({String name});), the provider is not found when compiling to WASM.
To Reproduce
Create a new Flutter project with web support.
Run flutter pub add provider
Replace main.dart with the following:
import'package:flutter/material.dart';
import'package:provider/provider.dart';
typedefRecord= ({String name});
voidmain() {
runApp(constMyApp());
}
classMyAppextendsStatelessWidget {
constMyApp({super.key});
// This widget is the root of your application.@overrideWidgetbuild(BuildContext context) {
returnProvider<Record>.value(
value: (name:'Hello, World!'),
child:constMaterialApp(
home:MyHomePage(),
),
);
}
}
classMyHomePageextendsStatefulWidget {
constMyHomePage({super.key});
@overrideState<MyHomePage> createState() =>_MyHomePageState();
}
class_MyHomePageStateextendsState<MyHomePage> {
@overrideWidgetbuild(BuildContext context) {
print('build 0');
final record = context.read<Record>();
print('build 1');
returnScaffold(
body:Center(
child:Text(record.name),
),
);
}
}
Run flutter run -d chrome --wasm to run the app on Chrome using WASM.
Note that the page cannot be built, and build 0 is printed to the console but build 1 is not.
Note that running the project with the exact same code works on web (e.g. flutter run -d chrome) as well as on Android and iOS but not on WASM.
Expected behavior
I expected the provider to be found just like it is on CanvasKit, Android, iOS, etc.
Not sure if this is a bug within just Provider, or it's something deeper related to the Flutter framework itself.
The text was updated successfully, but these errors were encountered:
Thank you @rrousselGit !
In that case, could you help me submit an issue for this on https://github.com/flutter/flutter , or help construct a code example without the use of Provider?
Unfortunately I'm not sure how this example would translate to the underlying APIs of the Flutter SDK.
Describe the bug
When using a provider with a record type (e.g.
typedef ExampleRecord = ({String name});
), the provider is not found when compiling to WASM.To Reproduce
flutter pub add provider
main.dart
with the following:flutter run -d chrome --wasm
to run the app on Chrome using WASM.build 0
is printed to the console butbuild 1
is not.flutter run -d chrome
) as well as on Android and iOS but not on WASM.Expected behavior
I expected the provider to be found just like it is on CanvasKit, Android, iOS, etc.
Not sure if this is a bug within just Provider, or it's something deeper related to the Flutter framework itself.
The text was updated successfully, but these errors were encountered: