I have problem when I use bloc.
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:7: Error: 'sthrow' isn't a type.
sthrow ProviderNotFoundException(T, context.widget.runtimeType);
^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:14: Error: Expected ';' after this.
sthrow ProviderNotFoundException(T, context.widget.runtimeType);
^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:41: Error: Expected ')' before this.
sthrow ProviderNotFoundException(T, context.widget.runtimeType);
^
2
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
Exception: Gradle task assembleDebug failed with exit code 1
RouteGenerator.dart:
static Route<dynamic>? onRouteGenerator(RouteSettings settings) {
switch (settings.name) {
case "/":
return MaterialPageRoute(
builder: (context) => BlocProvider(
create: (_) => di.locator<SplashBloc>(),
child: const SplashScreen(),
),
);
case "/iws":
return MaterialPageRoute(
builder: (context) => BlocProvider(
create: (_) => di.locator<UsersBloc>(),
child: const InputWellStatus(),
),
);
case "/login":
return MaterialPageRoute(
builder: (context) => BlocProvider(
create: (_) => di.locator<LoginBloc>(),
child: Login(),
),
);
case "/iwpt":
return MaterialPageRoute(
builder: (context) => const InputWellProdTest(),
);
case "/iss":
return MaterialPageRoute(
builder: (context) => const InputSonologStatus(),
);
default:
return null;
}
}
I beg you to help me solve this problem.
CodePudding user response:
change
sthrow ProviderNotFoundException(T, context.widget.runtimeType);
to
throw ProviderNotFoundException(T, context.widget.runtimeType);
CodePudding user response:
Try to change
sthrow ProviderNotFoundException(T, context.widget.runtimeType);
to
throw ProviderNotFoundException(T, context.widget.runtimeType);