diff --git a/packages/.vscode/extensions.json b/.vscode/extensions.json similarity index 100% rename from packages/.vscode/extensions.json rename to .vscode/extensions.json diff --git a/packages/.vscode/launch.json b/.vscode/launch.json similarity index 69% rename from packages/.vscode/launch.json rename to .vscode/launch.json index 6a077708049..26aabef2967 100644 --- a/packages/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "name": "opened test or devtools", - "cwd": "devtools_app", + "cwd": "packages/devtools_app", "request": "launch", "type": "dart", }, @@ -14,13 +14,13 @@ "name": "devtools", "request": "launch", "type": "dart", - "program": "devtools_app/lib/main.dart", + "program": "packages/devtools_app/lib/main.dart", }, { "name": "devtools + experiments", "request": "launch", "type": "dart", - "program": "devtools_app/lib/main.dart", + "program": "packages/devtools_app/lib/main.dart", "args": [ "--dart-define", "memory_disconnect_experience=true", @@ -32,21 +32,21 @@ "name": "devtools + profile", "request": "launch", "type": "dart", - "program": "devtools_app/lib/main.dart", + "program": "packages/devtools_app/lib/main.dart", "flutterMode": "profile", }, { "name": "devtools + release", "request": "launch", "type": "dart", - "program": "devtools_app/lib/main.dart", + "program": "packages/devtools_app/lib/main.dart", "flutterMode": "release", }, { "name": "devtools + profile + experiments", "request": "launch", "type": "dart", - "program": "devtools_app/lib/main.dart", + "program": "packages/devtools_app/lib/main.dart", "flutterMode": "profile", "args": [ "--dart-define=enable_experiments=true" @@ -56,50 +56,50 @@ "name": "devtools + release", "request": "launch", "type": "dart", - "program": "devtools_app/lib/main.dart", + "program": "packages/devtools_app/lib/main.dart", "flutterMode": "release", }, { "name": "memory/default", "request": "launch", "type": "dart", - "program": "devtools_app/test/test_infra/scenes/memory/default.stager_app.g.dart", + "program": "packages/devtools_app/test/test_infra/scenes/memory/default.stager_app.g.dart", }, { "name": "memory/diff_snapshot", "request": "launch", "type": "dart", - "program": "devtools_app/test/test_infra/scenes/memory/diff_snapshot.stager_app.g.dart", + "program": "packages/devtools_app/test/test_infra/scenes/memory/diff_snapshot.stager_app.g.dart", }, { "name": "performance/default", "request": "launch", "type": "dart", - "program": "devtools_app/test/test_infra/scenes/performance/default.stager_app.g.dart", + "program": "packages/devtools_app/test/test_infra/scenes/performance/default.stager_app.g.dart", }, { "name": "profiler/default", "request": "launch", "type": "dart", - "program": "devtools_app/test/test_infra/scenes/cpu_profiler/default.stager_app.g.dart", + "program": "packages/devtools_app/test/test_infra/scenes/cpu_profiler/default.stager_app.g.dart", }, { "name": "fixtures/flutter_app", "request": "launch", "type": "dart", - "program": "devtools_app/test/test_infra/fixtures/flutter_app/lib/main.dart", + "program": "packages/devtools_app/test/test_infra/fixtures/flutter_app/lib/main.dart", }, { "name": "fixtures/memory_app", "request": "launch", "type": "dart", - "program": "devtools_app/test/test_infra/fixtures/memory_app/lib/main.dart", + "program": "packages/devtools_app/test/test_infra/fixtures/memory_app/lib/main.dart", }, { "name": "standalone_ui/editor_sidebar", "request": "launch", "type": "dart", - "program": "devtools_app/test/test_infra/scenes/standalone_ui/editor_sidebar.stager_app.g.dart", + "program": "packages/devtools_app/test/test_infra/scenes/standalone_ui/editor_sidebar.stager_app.g.dart", "preLaunchTask": "Start DTD on Port 8500", }, { @@ -116,7 +116,7 @@ "name": "devtools_extensions: foo + sim", "request": "launch", "type": "dart", - "program": "devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/lib/main.dart", + "program": "packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/lib/main.dart", "args": [ "--dart-define=use_simulated_environment=true" ], @@ -125,7 +125,7 @@ "name": "devtools_extensions: dart_foo + sim", "request": "launch", "type": "dart", - "program": "devtools_extensions/example/packages_with_extensions/dart_foo/packages/dart_foo_devtools_extension/lib/main.dart", + "program": "packages/devtools_extensions/example/packages_with_extensions/dart_foo/packages/dart_foo_devtools_extension/lib/main.dart", "args": [ "--dart-define=use_simulated_environment=true" ], @@ -134,13 +134,13 @@ "name": "devtools_extensions: app_that_uses_foo", "request": "launch", "type": "dart", - "program": "devtools_extensions/example/app_that_uses_foo/lib/main.dart", + "program": "packages/devtools_extensions/example/app_that_uses_foo/lib/main.dart", }, { "name": "devtools_extensions: app_that_uses_foo - bin", "request": "launch", "type": "dart", - "program": "devtools_extensions/example/app_that_uses_foo/bin/script.dart", + "program": "packages/devtools_extensions/example/app_that_uses_foo/bin/script.dart", }, { "name": "attach", @@ -151,7 +151,7 @@ "name": "foo_devtools_extension example + simulated environment", "request": "launch", "type": "dart", - "program": "devtools_extensions/example/foo/packages/foo_devtools_extension/lib/main.dart", + "program": "packages/devtools_extensions/example/foo/packages/foo_devtools_extension/lib/main.dart", "args": [ "--dart-define=use_simulated_environment=true" ], diff --git a/packages/.vscode/settings.json b/.vscode/settings.json similarity index 100% rename from packages/.vscode/settings.json rename to .vscode/settings.json diff --git a/packages/.vscode/tasks.json b/.vscode/tasks.json similarity index 100% rename from packages/.vscode/tasks.json rename to .vscode/tasks.json diff --git a/packages/analysis_options.yaml b/analysis_options.yaml similarity index 99% rename from packages/analysis_options.yaml rename to analysis_options.yaml index 7ec8e122e04..40a61d23190 100644 --- a/packages/analysis_options.yaml +++ b/analysis_options.yaml @@ -12,9 +12,9 @@ analyzer: # treat missing required parameters as a warning (not a hint) missing_required_param: warning exclude: - - build/** + - '**/build/**' - '**.freezed.dart' - - flutter-sdk/ + - tool/flutter-sdk/ linter: rules: @@ -85,7 +85,6 @@ linter: # - one_member_abstracts # too many false positives # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 - overridden_fields - - package_api_docs - package_names - package_prefixed_library_names # - parameter_assignments # we do this commonly diff --git a/case_study/code_size/optimized/code_size_images/lib/animals.dart b/case_study/code_size/optimized/code_size_images/lib/animals.dart index e58ddde2b08..ff0a4981c29 100644 --- a/case_study/code_size/optimized/code_size_images/lib/animals.dart +++ b/case_study/code_size/optimized/code_size_images/lib/animals.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; class Animals extends StatelessWidget { + const Animals({super.key}); + @override Widget build(BuildContext context) { return ListView( diff --git a/case_study/code_size/optimized/code_size_images/lib/main.dart b/case_study/code_size/optimized/code_size_images/lib/main.dart index 77a7e66d2c0..21a836914ec 100644 --- a/case_study/code_size/optimized/code_size_images/lib/main.dart +++ b/case_study/code_size/optimized/code_size_images/lib/main.dart @@ -3,10 +3,12 @@ import 'package:flutter/material.dart'; import 'animals.dart'; void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + // This widget is the root of your application. @override Widget build(BuildContext context) { @@ -22,7 +24,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key}) : super(key: key); + const MyHomePage({super.key}); @override State createState() => _MyHomePageState(); @@ -35,7 +37,7 @@ class _MyHomePageState extends State { appBar: AppBar( title: const Text('Code Size Demo'), ), - body: Center( + body: const Center( child: Animals(), ), ); diff --git a/case_study/code_size/optimized/code_size_images/test/widget_test.dart b/case_study/code_size/optimized/code_size_images/test/widget_test.dart index ba11e18a0a4..bb00e04c9b1 100644 --- a/case_study/code_size/optimized/code_size_images/test/widget_test.dart +++ b/case_study/code_size/optimized/code_size_images/test/widget_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); + await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); diff --git a/case_study/code_size/optimized/code_size_package/lib/main.dart b/case_study/code_size/optimized/code_size_package/lib/main.dart index 0be9c940ded..d676f9238a9 100644 --- a/case_study/code_size/optimized/code_size_package/lib/main.dart +++ b/case_study/code_size/optimized/code_size_package/lib/main.dart @@ -5,10 +5,12 @@ import 'package:flutter/material.dart'; import 'package:steel_crypt/steel_crypt.dart' as encrypt; void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + @override Widget build(BuildContext context) { return MaterialApp( @@ -22,7 +24,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key, required this.title}) : super(key: key); + const MyHomePage({super.key, required this.title}); final String title; diff --git a/case_study/code_size/optimized/code_size_package/test/widget_test.dart b/case_study/code_size/optimized/code_size_package/test/widget_test.dart index 5ddbd623cd1..36cba9a6b19 100644 --- a/case_study/code_size/optimized/code_size_package/test/widget_test.dart +++ b/case_study/code_size/optimized/code_size_package/test/widget_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); + await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); diff --git a/case_study/code_size/unoptimized/code_size_images/lib/animals.dart b/case_study/code_size/unoptimized/code_size_images/lib/animals.dart index e58ddde2b08..ff0a4981c29 100644 --- a/case_study/code_size/unoptimized/code_size_images/lib/animals.dart +++ b/case_study/code_size/unoptimized/code_size_images/lib/animals.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; class Animals extends StatelessWidget { + const Animals({super.key}); + @override Widget build(BuildContext context) { return ListView( diff --git a/case_study/code_size/unoptimized/code_size_images/lib/main.dart b/case_study/code_size/unoptimized/code_size_images/lib/main.dart index 77a7e66d2c0..21a836914ec 100644 --- a/case_study/code_size/unoptimized/code_size_images/lib/main.dart +++ b/case_study/code_size/unoptimized/code_size_images/lib/main.dart @@ -3,10 +3,12 @@ import 'package:flutter/material.dart'; import 'animals.dart'; void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + // This widget is the root of your application. @override Widget build(BuildContext context) { @@ -22,7 +24,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key}) : super(key: key); + const MyHomePage({super.key}); @override State createState() => _MyHomePageState(); @@ -35,7 +37,7 @@ class _MyHomePageState extends State { appBar: AppBar( title: const Text('Code Size Demo'), ), - body: Center( + body: const Center( child: Animals(), ), ); diff --git a/case_study/code_size/unoptimized/code_size_images/test/widget_test.dart b/case_study/code_size/unoptimized/code_size_images/test/widget_test.dart index ba11e18a0a4..bb00e04c9b1 100644 --- a/case_study/code_size/unoptimized/code_size_images/test/widget_test.dart +++ b/case_study/code_size/unoptimized/code_size_images/test/widget_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); + await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); diff --git a/case_study/code_size/unoptimized/code_size_package/lib/main.dart b/case_study/code_size/unoptimized/code_size_package/lib/main.dart index b2bda32bdd9..3f9e149cc4c 100644 --- a/case_study/code_size/unoptimized/code_size_package/lib/main.dart +++ b/case_study/code_size/unoptimized/code_size_package/lib/main.dart @@ -2,10 +2,12 @@ import 'package:encrypt/encrypt.dart' as encrypt; import 'package:flutter/material.dart'; void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + @override Widget build(BuildContext context) { return MaterialApp( @@ -19,7 +21,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key, required this.title}) : super(key: key); + const MyHomePage({super.key, required this.title}); final String title; diff --git a/case_study/code_size/unoptimized/code_size_package/test/widget_test.dart b/case_study/code_size/unoptimized/code_size_package/test/widget_test.dart index 5ddbd623cd1..36cba9a6b19 100644 --- a/case_study/code_size/unoptimized/code_size_package/test/widget_test.dart +++ b/case_study/code_size/unoptimized/code_size_package/test/widget_test.dart @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); + await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); diff --git a/case_study/memory_leaks/memory_leak_app/lib/about.dart b/case_study/memory_leaks/memory_leak_app/lib/about.dart index 113ab2bd278..618987111ba 100644 --- a/case_study/memory_leaks/memory_leak_app/lib/about.dart +++ b/case_study/memory_leaks/memory_leak_app/lib/about.dart @@ -7,13 +7,16 @@ import 'package:flutter/material.dart'; import 'common.dart'; class About extends StatefulWidget { + // ignore: prefer_const_constructors_in_immutables, intentional example code. + About({super.key}); + @override State createState() => AboutState(); } class AboutState extends State { - static const String heading = '$aboutMenu\n\n'; - static const String helpText = ''' + static const heading = '$aboutMenu\n\n'; + static const helpText = ''' This application makes Restful HTTP GET requests to three different Restful servers. Selecting a request e.g., Weather will @@ -23,13 +26,13 @@ page to select another Restful request. The menu, on the main page, has options: '''; - static const String logOption = '\n $logMenu'; - static const String aboutOption = '\n $aboutMenu'; + static const logOption = '\n $logMenu'; + static const aboutOption = '\n $aboutMenu'; - static const String logDescr = ' display all messages.'; - static const String aboutDescr = ' display this page.'; + static const logDescr = ' display all messages.'; + static const aboutDescr = ' display this page.'; - final TextStyle defaultStyle = const TextStyle( + final defaultStyle = const TextStyle( fontSize: 20, color: Colors.blueGrey, ); diff --git a/case_study/memory_leaks/memory_leak_app/lib/main.dart b/case_study/memory_leaks/memory_leak_app/lib/main.dart index 84d58a2a357..fa7d41b6c80 100644 --- a/case_study/memory_leaks/memory_leak_app/lib/main.dart +++ b/case_study/memory_leaks/memory_leak_app/lib/main.dart @@ -16,7 +16,7 @@ void main() { Logging.logging.add('Starting...'); runApp( - MaterialApp( + const MaterialApp( // Title title: appName, // Home @@ -26,6 +26,8 @@ void main() { } class MyHome extends StatefulWidget { + const MyHome({super.key}); + @override State createState() => MyHomeState(); } @@ -101,6 +103,7 @@ class MyHomeState extends State with SingleTickerProviderStateMixin { ); break; default: + // ignore: avoid_print, fine for example app. print('ERROR: Unhandled Menu.'); } } diff --git a/case_study/memory_leaks/memory_leak_app/lib/restful_servers.dart b/case_study/memory_leaks/memory_leak_app/lib/restful_servers.dart index c4bcce7137b..9c764d55fa3 100644 --- a/case_study/memory_leaks/memory_leak_app/lib/restful_servers.dart +++ b/case_study/memory_leaks/memory_leak_app/lib/restful_servers.dart @@ -13,9 +13,9 @@ abstract class RestfulAPI { String get activeFriendlyName; - dynamic findData(dynamic data); + Object? findData(Object? data); - String display(dynamic data, int index); + String display(Object? data, int index); } /// StarWars information server. @@ -25,20 +25,20 @@ class StarWars extends RestfulAPI { _activeFriendlyName = name; } - static const String starWarsFilms = 'StarWars Films'; - static const String starWarsPeople = 'StarWars People'; - static const String starWarsPlanets = 'StarWars Planets'; - static const String starWarsSpecies = 'StarWars Species'; - static const String starWarsStarships = 'StarWars Starships'; - static const String starWarsVehicles = 'StarWars Vehicles'; - - static const Map _friendlyNames = { - '$starWarsFilms': 'https://swapi.co/api/films', - '$starWarsPeople': 'https://swapi.co/api/people', - '$starWarsPlanets': 'https://swapi.co/api/planets', - '$starWarsSpecies': 'https://swapi.co/api/species', - '$starWarsStarships': 'https://swapi.co/api/starships', - '$starWarsVehicles': 'https://swapi.co/api/vehicles', + static const starWarsFilms = 'StarWars Films'; + static const starWarsPeople = 'StarWars People'; + static const starWarsPlanets = 'StarWars Planets'; + static const starWarsSpecies = 'StarWars Species'; + static const starWarsStarships = 'StarWars Starships'; + static const starWarsVehicles = 'StarWars Vehicles'; + + static const _friendlyNames = { + starWarsFilms: 'https://swapi.co/api/films', + starWarsPeople: 'https://swapi.co/api/people', + starWarsPlanets: 'https://swapi.co/api/planets', + starWarsSpecies: 'https://swapi.co/api/species', + starWarsStarships: 'https://swapi.co/api/starships', + starWarsVehicles: 'https://swapi.co/api/vehicles', }; late final String _activeFriendlyName; @@ -53,14 +53,16 @@ class StarWars extends RestfulAPI { String uri() => _defaultUri; @override - dynamic findData(dynamic data) => data['results']; + Object? findData(Object? data) => (data as Map)['results']; @override - String display(dynamic data, int index) { + String display(Object? data, int index) { // data from film Restful URI has slightly different format // title instead of name. final isFilm = _defaultUri == _friendlyNames[starWarsFilms]; - return data == null ? '' : data[index][isFilm ? 'title' : 'name']; + return data == null + ? '' + : ((data as Map)[index] as Map)[isFilm ? 'title' : 'name']; } } @@ -70,7 +72,7 @@ class CitiBikesNYC extends RestfulAPI { static const citiBikesUri = 'https://feeds.citibikenyc.com/stations/stations.json'; - static const String friendlyName = 'NYC Bike Sharing'; + static const friendlyName = 'NYC Bike Sharing'; @override String uri() => citiBikesUri; @@ -79,11 +81,11 @@ class CitiBikesNYC extends RestfulAPI { String get activeFriendlyName => friendlyName; @override - dynamic findData(dynamic data) => data['stationBeanList']; + Object? findData(Object? data) => (data as Map)['stationBeanList']; @override - String display(dynamic data, int index) => - data == null ? '' : data[index]['stationName']; + String display(Object? data, int index) => + data == null ? '' : ((data as List)[index] as Map)['stationName']; } class CityInformation { @@ -108,7 +110,7 @@ class CityInformation { /// Subscribe for free OpenWeatherMap then create an appid using: /// https://home.openweathermap.org/api_keys class OpenWeatherMapAPI extends RestfulAPI { - static const String friendlyName = 'Weather'; + static const friendlyName = 'Weather'; static const _baseUrl = 'http://api.openweathermap.org/data/2.5/group?id='; static const _unitsOption = '&units=imperial'; @@ -145,9 +147,9 @@ class OpenWeatherMapAPI extends RestfulAPI { CityInformation? secondCity; String _cityIdsList({int initialStart = -1, int count = 20}) { - final StringBuffer buff = StringBuffer(); + final buff = StringBuffer(); - final int start = initialStart == -1 ? randomSeed() : initialStart; + final start = initialStart == -1 ? randomSeed() : initialStart; firstCity = CityInformation(_cityIds.keys.toList()[start]); secondCity = firstCity; @@ -174,18 +176,19 @@ class OpenWeatherMapAPI extends RestfulAPI { String get activeFriendlyName => friendlyName; @override - dynamic findData(dynamic data) => data['list']; // weather group + Object? findData(Object? data) => (data as Map)['list']; // weather group - static String cityName(dynamic data, int index) => '${data[index]['name']}'; + static String cityName(Object? data, int index) => + '${((data as List)[index] as Map)['name']}'; - static String temperature(dynamic data, int index) => - '${data[index]['main']['temp']}'; + static String temperature(Object? data, int index) => + '${(((data as List)[index] as Map)['main'] as Map)['temp']}'; - static String weather(dynamic data, int index) => - '${data[index]['weather'][0]['main']}'; + static String weather(Object? data, int index) => + '${((((data as Map)[index] as Map)['weather'] as List)[0] as Map)['main']}'; @override - String display(dynamic data, int index) => + String display(Object? data, int index) => '${OpenWeatherMapAPI.cityName(data, index)} ' '${OpenWeatherMapAPI.temperature(data, index)} ' '${OpenWeatherMapAPI.weather(data, index)}'; diff --git a/case_study/memory_leaks/memory_leak_app/lib/tabs/http_data.dart b/case_study/memory_leaks/memory_leak_app/lib/tabs/http_data.dart index fbecb2ad8ba..ed14506fcf0 100644 --- a/case_study/memory_leaks/memory_leak_app/lib/tabs/http_data.dart +++ b/case_study/memory_leaks/memory_leak_app/lib/tabs/http_data.dart @@ -15,6 +15,8 @@ import 'settings.dart'; /// Create a stateful widget class MyGetHttpData extends StatefulWidget { + const MyGetHttpData({super.key}); + @override State createState() => MyGetHttpDataState(); } @@ -25,23 +27,23 @@ class MyGetHttpDataState extends State { api = currentRestfulAPI = computeUri(); } - final Logging logs = Logging.logging; + final logs = Logging.logging; late RestfulAPI api; - List? data; + List? data; RestfulAPI computeUri() { switch (restfulApi) { - case '${OpenWeatherMapAPI.friendlyName}': + case OpenWeatherMapAPI.friendlyName: return OpenWeatherMapAPI(); - case '${CitiBikesNYC.friendlyName}': + case CitiBikesNYC.friendlyName: return CitiBikesNYC(); - case '${StarWars.starWarsFilms}': - case '${StarWars.starWarsPeople}': - case '${StarWars.starWarsPlanets}': - case '${StarWars.starWarsSpecies}': - case '${StarWars.starWarsStarships}': - case '${StarWars.starWarsVehicles}': + case StarWars.starWarsFilms: + case StarWars.starWarsPeople: + case StarWars.starWarsPlanets: + case StarWars.starWarsSpecies: + case StarWars.starWarsStarships: + case StarWars.starWarsVehicles: return StarWars(restfulApi); default: return StarWars(); @@ -73,7 +75,7 @@ class MyGetHttpDataState extends State { // Get the JSON data final dataConvertedToJSON = json.decode(response.body); // Extract the required part and assign it to the global variable named data - data = api.findData(dataConvertedToJSON); + data = api.findData(dataConvertedToJSON) as List; }); return 'Successful'; @@ -91,7 +93,6 @@ class MyGetHttpDataState extends State { bottom: PreferredSize( preferredSize: const Size.fromHeight(48.0), child: Theme( - // ignore: deprecated_member_use data: Theme.of(context), child: Container( height: 48.0, diff --git a/case_study/memory_leaks/memory_leak_app/lib/tabs/logger.dart b/case_study/memory_leaks/memory_leak_app/lib/tabs/logger.dart index 1c13d5eb77c..f563b0eb0e7 100644 --- a/case_study/memory_leaks/memory_leak_app/lib/tabs/logger.dart +++ b/case_study/memory_leaks/memory_leak_app/lib/tabs/logger.dart @@ -9,11 +9,13 @@ import 'package:flutter/material.dart'; import '../common.dart'; import '../logging.dart'; -// class Logger extends StatelessWidget { class Logger extends StatefulWidget { - final Logging _logging = Logging.logging; + Logger({super.key}); + + final _logging = Logging.logging; @override + // ignore: no_logic_in_create_state, intentional leaking example. State createState() => LoggerState(_logging); } @@ -21,7 +23,7 @@ class LoggerState extends State { LoggerState(this._logging); final Logging _logging; - final List _saved = []; + final _saved = []; final _biggerFont = const TextStyle(fontSize: 18.0); @override @@ -34,7 +36,7 @@ class LoggerState extends State { ); } - // ignore: unused_element + // ignore: unused_element, intentional example code. void _pushSaved() { unawaited( Navigator.of(context).push( diff --git a/case_study/memory_leaks/memory_leak_app/lib/tabs/settings.dart b/case_study/memory_leaks/memory_leak_app/lib/tabs/settings.dart index 3b27adb9f62..1814805cfbb 100644 --- a/case_study/memory_leaks/memory_leak_app/lib/tabs/settings.dart +++ b/case_study/memory_leaks/memory_leak_app/lib/tabs/settings.dart @@ -11,15 +11,16 @@ import '../restful_servers.dart'; import 'http_data.dart'; class Settings extends StatefulWidget { - Settings() : restfulRoot = currentRestfulAPI; + Settings({super.key}) : restfulRoot = currentRestfulAPI; - final Logging logs = Logging.logging; + final logs = Logging.logging; static late final SettingsState state; final RestfulAPI restfulRoot; @override + // ignore: no_logic_in_create_state, intentional leaking example. State createState() { state = SettingsState(); return state; @@ -35,17 +36,17 @@ late RestfulAPI currentRestfulAPI; class SettingsState extends State { Map values = { - '${CitiBikesNYC.friendlyName}': Icons.directions_bike, - '${StarWars.starWarsFilms}': Icons.videocam, - '${StarWars.starWarsPeople}': Icons.people_outline, - '${StarWars.starWarsPlanets}': Icons.bubble_chart, - '${StarWars.starWarsSpecies}': Icons.android, - '${StarWars.starWarsStarships}': Icons.tram, - '${StarWars.starWarsVehicles}': Icons.time_to_leave, - '${OpenWeatherMapAPI.friendlyName}': Icons.cloud, + CitiBikesNYC.friendlyName: Icons.directions_bike, + StarWars.starWarsFilms: Icons.videocam, + StarWars.starWarsPeople: Icons.people_outline, + StarWars.starWarsPlanets: Icons.bubble_chart, + StarWars.starWarsSpecies: Icons.android, + StarWars.starWarsStarships: Icons.tram, + StarWars.starWarsVehicles: Icons.time_to_leave, + OpenWeatherMapAPI.friendlyName: Icons.cloud, }; - final Logging logs = Logging.logging; + final logs = Logging.logging; @override Widget build(BuildContext context) { @@ -66,7 +67,8 @@ class SettingsState extends State { unawaited( Navigator.push( context, - MaterialPageRoute(builder: (context) => MyGetHttpData()), + MaterialPageRoute( + builder: (context) => const MyGetHttpData()), ), ); }, diff --git a/case_study/platform_channel/lib/channel_demo.dart b/case_study/platform_channel/lib/channel_demo.dart index 2312175ebc5..4ddbcd45c02 100644 --- a/case_study/platform_channel/lib/channel_demo.dart +++ b/case_study/platform_channel/lib/channel_demo.dart @@ -4,6 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class ChannelDemo extends StatefulWidget { + const ChannelDemo({super.key}); + @override State createState() => _ChannelDemoState(); } diff --git a/case_study/platform_channel/lib/main.dart b/case_study/platform_channel/lib/main.dart index 34ddf95306f..632d6ce4f27 100644 --- a/case_study/platform_channel/lib/main.dart +++ b/case_study/platform_channel/lib/main.dart @@ -4,11 +4,13 @@ import 'package:flutter/material.dart'; import 'channel_demo.dart'; -void main() => runApp(MyApp()); +void main() => runApp(const MyApp()); const platformChannelTitle = 'Platform Channel Demo'; class MyApp extends StatelessWidget { + const MyApp({super.key}); + @override Widget build(BuildContext context) { return MaterialApp( @@ -35,7 +37,7 @@ class _HomePage extends StatelessWidget { unawaited( Navigator.push( context, - MaterialPageRoute(builder: (context) => ChannelDemo()), + MaterialPageRoute(builder: (context) => const ChannelDemo()), ), ); }, diff --git a/case_study/platform_channel/test/widget_test.dart b/case_study/platform_channel/test/widget_test.dart index b5c8be0ee1f..0fd35644e5b 100644 --- a/case_study/platform_channel/test/widget_test.dart +++ b/case_study/platform_channel/test/widget_test.dart @@ -13,7 +13,7 @@ import 'package:platform_channel/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); + await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); diff --git a/packages/devtools_app/analysis_options.yaml b/packages/devtools_app/analysis_options.yaml index 245c0ff9a91..b90b4817ad2 100644 --- a/packages/devtools_app/analysis_options.yaml +++ b/packages/devtools_app/analysis_options.yaml @@ -1,4 +1,4 @@ -include: ../analysis_options.yaml +include: ../../analysis_options.yaml analyzer: exclude: diff --git a/packages/devtools_app/lib/devtools.dart b/packages/devtools_app/lib/devtools.dart index b3dfa1546c7..8250352b361 100644 --- a/packages/devtools_app/lib/devtools.dart +++ b/packages/devtools_app/lib/devtools.dart @@ -10,4 +10,4 @@ /// Note: a regexp in the `dt update-version' command logic matches the constant /// declaration `const version =`. If you change the declaration you must also /// modify the regex in the `dt update-version' command logic. -const version = '2.41.0'; +const version = '2.42.0-dev.0'; diff --git a/packages/devtools_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/devtools_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 98cea036417..cadfa603a2e 100644 --- a/packages/devtools_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/devtools_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -59,6 +59,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" + enableGPUValidationMode = "1" allowLocationSimulation = "YES"> diff --git a/packages/devtools_app/pubspec.yaml b/packages/devtools_app/pubspec.yaml index e6edfb22ea5..67c2585d930 100644 --- a/packages/devtools_app/pubspec.yaml +++ b/packages/devtools_app/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: none # Note: this version should only be updated by running the 'dt update-version' # command that updates the version here and in 'devtools.dart'. -version: 2.41.0 +version: 2.42.0-dev.0 repository: https://github.com/flutter/devtools/tree/master/packages/devtools_app @@ -12,6 +12,8 @@ environment: sdk: ">=3.7.0-160.0.dev <4.0.0" flutter: ">=3.27.0-1.0.pre.563" +resolution: workspace + dependencies: ansi_up: ^1.0.0 ansicolor: ^2.0.0 @@ -21,9 +23,9 @@ dependencies: collection: ^1.15.0 dap: ^1.1.0 dds_service_extensions: ^2.0.0 - devtools_app_shared: ^0.2.2 - devtools_extensions: ^0.3.0-wip - devtools_shared: ^10.0.1 + devtools_app_shared: + devtools_extensions: + devtools_shared: dtd: ^2.4.0 file: ^7.0.0 file_selector: ^1.0.0 @@ -166,11 +168,3 @@ flutter: dependency_overrides: ansi_up: path: ../../third_party/packages/ansi_up - devtools_shared: - path: ../devtools_shared - devtools_app_shared: - path: ../devtools_app_shared - devtools_test: - path: ../devtools_test - devtools_extensions: - path: ../devtools_extensions diff --git a/packages/devtools_app_shared/CHANGELOG.md b/packages/devtools_app_shared/CHANGELOG.md index 3f8398c79d2..08a7489ba2a 100644 --- a/packages/devtools_app_shared/CHANGELOG.md +++ b/packages/devtools_app_shared/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.0 +* Bump minimum Dart SDK version to `3.6.0`. +* Bump minimum Flutter SDK version to `3.24.0`. +* Bump `devtools_shared` dependency to `^11.1.0`. + ## 0.2.4 * Add `updateQueryParameter` utility method. * Add `jump` parameter to `ScrollController.autoScrollToBottom` extension method. diff --git a/packages/devtools_app_shared/analysis_options.yaml b/packages/devtools_app_shared/analysis_options.yaml deleted file mode 100644 index 35d2ba4c6d2..00000000000 --- a/packages/devtools_app_shared/analysis_options.yaml +++ /dev/null @@ -1,6 +0,0 @@ -include: ../analysis_options.yaml - -analyzer: - exclude: - - bin/** - - example/** diff --git a/packages/devtools_app_shared/example/service_example.dart b/packages/devtools_app_shared/example/service_example.dart index 1da1f3f9a1d..848a39025fa 100644 --- a/packages/devtools_app_shared/example/service_example.dart +++ b/packages/devtools_app_shared/example/service_example.dart @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: unused_local_variable +// ignore_for_file: unused_local_variable, avoid_print import 'dart:async'; import 'package:devtools_app_shared/service.dart'; import 'package:devtools_app_shared/service_extensions.dart' as extensions; import 'package:devtools_shared/service.dart'; -import 'package:flutter/foundation.dart'; import 'package:vm_service/vm_service.dart'; void main() async { @@ -41,7 +40,7 @@ void main() async { ); /// Example: Get a service extension state. - final ValueListenable performanceOverlayEnabled = + final performanceOverlayEnabled = serviceManager.serviceExtensionManager.getServiceExtensionState( extensions.performanceOverlay.extension, ); diff --git a/packages/devtools_app_shared/example/utils/globals_example.dart b/packages/devtools_app_shared/example/utils/globals_example.dart index 1e22e557fa9..80405081e57 100644 --- a/packages/devtools_app_shared/example/utils/globals_example.dart +++ b/packages/devtools_app_shared/example/utils/globals_example.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: avoid_print + import 'package:devtools_app_shared/utils.dart'; void main() { diff --git a/packages/devtools_app_shared/example/utils/utils_example.dart b/packages/devtools_app_shared/example/utils/utils_example.dart index bc8c8dc7653..5c445316995 100644 --- a/packages/devtools_app_shared/example/utils/utils_example.dart +++ b/packages/devtools_app_shared/example/utils/utils_example.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: avoid_print + import 'package:devtools_app_shared/utils.dart'; /// This example demonstrates using shared utility methods from diff --git a/packages/devtools_app_shared/pubspec.yaml b/packages/devtools_app_shared/pubspec.yaml index a3c31dafd43..f9bbabfa703 100644 --- a/packages/devtools_app_shared/pubspec.yaml +++ b/packages/devtools_app_shared/pubspec.yaml @@ -1,16 +1,18 @@ name: devtools_app_shared description: Package of Dart & Flutter structures shared between devtools_app and devtools extensions. -version: 0.2.4 +version: 0.3.0 repository: https://github.com/flutter/devtools/tree/master/packages/devtools_app_shared environment: - sdk: ">=3.4.3 <4.0.0" - flutter: ">=3.22.2" + sdk: ">=3.6.0 <4.0.0" + flutter: ">=3.24.0" + +resolution: workspace dependencies: collection: ^1.15.0 dds_service_extensions: ^2.0.0 - devtools_shared: ^10.0.2 + devtools_shared: ^11.1.0 dtd: ^2.1.0 flutter: sdk: flutter @@ -58,7 +60,3 @@ flutter: weight: 500 - asset: fonts/Roboto_Mono/RobotoMono-Bold.ttf weight: 700 - -dependency_overrides: - devtools_shared: - path: ../devtools_shared diff --git a/packages/devtools_extensions/CHANGELOG.md b/packages/devtools_extensions/CHANGELOG.md index e55e64e3cb4..0f24ebf8d23 100644 --- a/packages/devtools_extensions/CHANGELOG.md +++ b/packages/devtools_extensions/CHANGELOG.md @@ -1,5 +1,6 @@ ## 0.3.0-dev.1 -* Bump `devtools_app_shared` dependency to `0.2.4`. +* Bump `devtools_app_shared` dependency to `0.3.0`. +* Bump `devtools_shared` dependency to `11.1.0`. ## 0.3.0-dev.0 * Add `ExtensionManager.copyToClipboard` method. diff --git a/packages/devtools_extensions/analysis_options.yaml b/packages/devtools_extensions/analysis_options.yaml deleted file mode 100644 index 83f90ee34e3..00000000000 --- a/packages/devtools_extensions/analysis_options.yaml +++ /dev/null @@ -1,5 +0,0 @@ -include: ../analysis_options.yaml - -analyzer: - exclude: - - example/** diff --git a/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/lib/src/feature_examples/service_extension_example.dart b/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/lib/src/feature_examples/service_extension_example.dart index 457acbf788d..357b26ae18a 100644 --- a/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/lib/src/feature_examples/service_extension_example.dart +++ b/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/lib/src/feature_examples/service_extension_example.dart @@ -177,6 +177,7 @@ class _GridEntry extends StatelessWidget { class SelectedThing extends StatefulWidget { const SelectedThing({ + super.key, required this.selectedThingId, required this.onIncrement, required this.onDecrement, diff --git a/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/pubspec.yaml b/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/pubspec.yaml index 49b96454184..29942bcf5c5 100644 --- a/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/pubspec.yaml +++ b/packages/devtools_extensions/example/packages_with_extensions/foo/packages/foo_devtools_extension/pubspec.yaml @@ -14,6 +14,7 @@ dependencies: devtools_extensions: path: ../../../../../../devtools_extensions dtd: ^2.2.0 + path: ^1.8.0 flutter: sdk: flutter diff --git a/packages/devtools_extensions/pubspec.yaml b/packages/devtools_extensions/pubspec.yaml index 85a8bb14db4..eb966ac07fb 100644 --- a/packages/devtools_extensions/pubspec.yaml +++ b/packages/devtools_extensions/pubspec.yaml @@ -8,13 +8,15 @@ environment: sdk: ">=3.6.0-149.3.beta <4.0.0" flutter: ">=3.25.0-0.1.pre" +resolution: workspace + executables: devtools_extensions: devtools_extensions dependencies: args: ^2.4.2 - devtools_shared: ^10.0.2 - devtools_app_shared: ^0.2.4 + devtools_shared: ^11.1.0 + devtools_app_shared: ^0.3.0 flutter: sdk: flutter io: ^1.0.4 @@ -40,9 +42,3 @@ dev_dependencies: flutter: uses-material-design: true - -dependency_overrides: - devtools_app_shared: - path: ../devtools_app_shared - devtools_shared: - path: ../devtools_shared diff --git a/packages/devtools_shared/CHANGELOG.md b/packages/devtools_shared/CHANGELOG.md index 2c398e4e453..70b5a0fe14b 100644 --- a/packages/devtools_shared/CHANGELOG.md +++ b/packages/devtools_shared/CHANGELOG.md @@ -1,3 +1,6 @@ +# 11.1.0 +* Bump minimum SDK version to `3.6.0`. + # 11.0.0 * **Breaking change:** replace `apiGetLastReleaseNotesVersion` with `ReleaseNotesApi.getLastReleaseNotesVersion`. * **Breaking change:** replace `apiSetLastReleaseNotesVersion` with `ReleaseNotesApi.setLastReleaseNotesVersion`. diff --git a/packages/devtools_shared/analysis_options.yaml b/packages/devtools_shared/analysis_options.yaml deleted file mode 100644 index 5e2133eb696..00000000000 --- a/packages/devtools_shared/analysis_options.yaml +++ /dev/null @@ -1 +0,0 @@ -include: ../analysis_options.yaml diff --git a/packages/devtools_shared/pubspec.yaml b/packages/devtools_shared/pubspec.yaml index c2ed4905845..4593aafda83 100644 --- a/packages/devtools_shared/pubspec.yaml +++ b/packages/devtools_shared/pubspec.yaml @@ -1,12 +1,14 @@ name: devtools_shared description: Package of shared Dart structures between devtools_app, dds, and other tools. -version: 11.0.0 +version: 11.1.0 repository: https://github.com/flutter/devtools/tree/master/packages/devtools_shared environment: - sdk: ">=3.4.3 <4.0.0" + sdk: ">=3.6.0 <4.0.0" + +resolution: workspace dependencies: args: ^2.4.2 diff --git a/packages/devtools_test/analysis_options.yaml b/packages/devtools_test/analysis_options.yaml deleted file mode 100644 index 5e2133eb696..00000000000 --- a/packages/devtools_test/analysis_options.yaml +++ /dev/null @@ -1 +0,0 @@ -include: ../analysis_options.yaml diff --git a/packages/devtools_test/pubspec.yaml b/packages/devtools_test/pubspec.yaml index a9e6eeacabb..df473d2704c 100644 --- a/packages/devtools_test/pubspec.yaml +++ b/packages/devtools_test/pubspec.yaml @@ -8,16 +8,15 @@ environment: sdk: ">=3.7.0-160.0.dev <4.0.0" flutter: ">=3.27.0-1.0.pre.563" +resolution: workspace + dependencies: async: ^2.0.0 collection: ^1.15.0 dap: ^1.1.0 devtools_app: - path: ../devtools_app devtools_app_shared: - path: ../devtools_app_shared devtools_shared: - path: ../devtools_shared flutter: sdk: flutter flutter_test: @@ -31,16 +30,6 @@ dependencies: vm_service: ^14.2.1 webkit_inspection_protocol: '>=0.5.0 <2.0.0' -dependency_overrides: - devtools_app: - path: ../devtools_app - devtools_app_shared: - path: ../devtools_app_shared - devtools_extensions: - path: ../devtools_extensions - devtools_shared: - path: ../devtools_shared - dev_dependencies: build_runner: ^2.3.3 flutter_lints: ^4.0.0 diff --git a/packages/pubspec.yaml b/packages/pubspec.yaml deleted file mode 100644 index 80b7037f1a5..00000000000 --- a/packages/pubspec.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# This file exists to serve analysis_options.yaml -name: devtools_root -publish_to: none - -environment: - sdk: ^3.2.0 - -dev_dependencies: - flutter_lints: ^4.0.0 diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 00000000000..a60ef73635f --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,14 @@ +name: _devtools +environment: + sdk: ^3.6.0 +workspace: + - packages/devtools_app + - packages/devtools_app_shared + - packages/devtools_extensions + - packages/devtools_shared + - packages/devtools_test + - tool + +dev_dependencies: + build_runner: ^2.3.3 + flutter_lints: ^4.0.0 diff --git a/tool/analysis_options.yaml b/tool/analysis_options.yaml index 6cc07fc9a49..332e974a273 100644 --- a/tool/analysis_options.yaml +++ b/tool/analysis_options.yaml @@ -7,8 +7,6 @@ analyzer: linter: rules: # - avoid_dynamic_calls - # Obsolete with the new Dart formatter. - # - require_trailing_commas - unawaited_futures - depend_on_referenced_packages - directives_ordering diff --git a/tool/lib/commands/generate_code.dart b/tool/lib/commands/generate_code.dart index 8c341e2de66..8f03b888402 100644 --- a/tool/lib/commands/generate_code.dart +++ b/tool/lib/commands/generate_code.dart @@ -72,8 +72,7 @@ class GenerateCodeCommand extends Command { } await runOverPackages( - CliCommand.flutter([ - 'pub', + CliCommand.dart([ 'run', 'build_runner', 'build', diff --git a/tool/pubspec.yaml b/tool/pubspec.yaml index e22d9d54614..631f782f579 100644 --- a/tool/pubspec.yaml +++ b/tool/pubspec.yaml @@ -5,21 +5,19 @@ publish_to: none environment: sdk: ">=3.7.0-160.0.dev <4.0.0" +resolution: workspace + executables: dt: dt dependencies: args: ^2.4.2 cli_util: ^0.4.1 - collection: ^1.19.1 + collection: ^1.19.0 io: ^1.0.4 + lints: ^4.0.0 path: ^1.9.0 yaml: ^3.1.2 - -dependency_overrides: - devtools_shared: - path: ../packages/devtools_shared - lints: ^4.0.0 dev_dependencies: test: ^1.25.8