Reputation: 975
I am new to Flutter and came across this issue:
$ flutter build web
💪 Building with sound null safety 💪
Target dart2js failed: Exception: Warning: The 'dart2js' entrypoint script is deprecated, please use 'dart compile js' instead.
lib/main.dart:5:11:
Error: Couldn't find constructor 'ProviderScope'.
const ProviderScope(
^^^^^^^^^^^^^
Error: Compilation failed.
The code I have is the following:
import 'package:flutter/material.dart';
void main() {
runApp(
const ProviderScope(
child: MyApp(),
),
);
}
How can I solve this compilation issue?
The reference to the tutorial I am following is: https://thiagoevoa.medium.com/creating-an-end-to-end-project-from-node-js-backend-to-flutter-app-a8df8ffdde5b
Upvotes: 1
Views: 204
Reputation: 2825
An import is missing:
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter/material.dart';
void main() {
runApp(
const ProviderScope(
child: MyApp(),
),
);
}
Upvotes: 2