Skip to content

Commit

Permalink
Update for Flutter 3.10 beta (#1746)
Browse files Browse the repository at this point in the history
## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] All existing and new tests are passing.

---------

Co-authored-by: David Iglesias <[email protected]>
Co-authored-by: Mark Thompson <[email protected]>
Co-authored-by: John Ryan <[email protected]>
  • Loading branch information
4 people committed May 10, 2023
1 parent 474756c commit 36e7a6a
Show file tree
Hide file tree
Showing 188 changed files with 1,777 additions and 1,966 deletions.
1 change: 1 addition & 0 deletions analysis_defaults/lib/flutter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ linter:
test_types_in_equals: true
throw_in_finally: true
unawaited_futures: true
unnecessary_breaks: true
unnecessary_statements: true
use_super_parameters: true
2 changes: 1 addition & 1 deletion analysis_defaults/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Analysis defaults for flutter/samples
publish_to: none

environment:
sdk: '>=2.19.5 <4.0.0'
sdk: ^3.0.0-0

# NOTE: Code is not allowed in this package. Do not add dependencies.
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion android_splash_screen/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish_to: "none"
version: 1.0.0+1

environment:
sdk: '>=2.19.5 <4.0.0'
sdk: ^3.0.0-0

dependencies:
flutter:
Expand Down
30 changes: 15 additions & 15 deletions animations/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled.

version:
revision: f732038a8cf4562ce38a1d7debb30209ae3da896
revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
channel: beta

project_type: app
Expand All @@ -13,26 +13,26 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
base_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
create_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
base_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
- platform: android
create_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
base_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
create_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
base_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
- platform: ios
create_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
base_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
create_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
base_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
- platform: linux
create_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
base_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
create_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
base_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
- platform: macos
create_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
base_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
create_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
base_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
- platform: web
create_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
base_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
create_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
base_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
- platform: windows
create_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
base_revision: f732038a8cf4562ce38a1d7debb30209ae3da896
create_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd
base_revision: d11aff97d2df15a076d285f6ad18da75c0d75ddd

# User provided section

Expand Down
1 change: 1 addition & 0 deletions animations/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "dev.flutter.animations"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

Expand Down
3 changes: 1 addition & 2 deletions animations/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.animations">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
3 changes: 1 addition & 2 deletions animations/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.animations">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="animations"
android:name="${applicationName}"
Expand Down
3 changes: 1 addition & 2 deletions animations/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.animations">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
2 changes: 1 addition & 1 deletion animations/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
9 changes: 5 additions & 4 deletions animations/lib/src/basics/animated_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
),
child: child,
onPressed: () {
if (controller.status == AnimationStatus.completed) {
controller.reverse();
} else {
controller.forward();
switch (controller.status) {
case AnimationStatus.completed:
controller.reverse();
default:
controller.forward();
}
},
);
Expand Down
9 changes: 5 additions & 4 deletions animations/lib/src/basics/animation_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ class _AnimationControllerDemoState extends State<AnimationControllerDemo>
ElevatedButton(
child: const Text('animate'),
onPressed: () {
if (controller.status == AnimationStatus.completed) {
controller.reverse();
} else {
controller.forward();
switch (controller.status) {
case AnimationStatus.completed:
controller.reverse();
default:
controller.forward();
}
},
)
Expand Down
18 changes: 11 additions & 7 deletions animations/lib/src/basics/tweens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ class _TweenDemoState extends State<TweenDemo>
),
ElevatedButton(
child: Text(
controller.status == AnimationStatus.completed
? 'Buy a Mansion'
: 'Win Lottery',
switch (controller.status) {
AnimationStatus.completed => 'Buy a Mansion',
AnimationStatus.forward => 'Accruing...',
AnimationStatus.reverse => 'Spending...',
_ => 'Win the lottery',
},
),
onPressed: () {
if (controller.status == AnimationStatus.completed) {
controller.reverse();
} else {
controller.forward();
switch (controller.status) {
case AnimationStatus.completed:
controller.reverse();
default:
controller.forward();
}
},
)
Expand Down
2 changes: 1 addition & 1 deletion animations/macos/Runner/MainFlutterWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FlutterMacOS

class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let flutterViewController = FlutterViewController.init()
let flutterViewController = FlutterViewController()
let windowFrame = self.frame
self.contentViewController = flutterViewController
self.setFrame(windowFrame, display: true)
Expand Down
2 changes: 1 addition & 1 deletion animations/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0+1
publish_to: none

environment:
sdk: '>=2.19.5 <4.0.0'
sdk: ^3.0.0-0

dependencies:
flutter:
Expand Down
7 changes: 0 additions & 7 deletions background_isolate_channels/lib/simple_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,12 @@ class SimpleDatabase {
RootIsolateToken rootIsolateToken = RootIsolateToken.instance!;
_sendPort
.send(_Command(_Codes.init, arg0: _path, arg1: rootIsolateToken));
break;
case _Codes.ack:
_completers.removeLast().complete();
break;
case _Codes.result:
_resultsStream.last.add(command.arg0 as String);
break;
case _Codes.done:
_resultsStream.removeLast().close();
break;
default:
debugPrint('SimpleDatabase unrecognized command: ${command.code}');
}
Expand Down Expand Up @@ -198,13 +194,10 @@ class _SimpleDatabaseServer {
// ----------------------------------------------------------------------
BackgroundIsolateBinaryMessenger.ensureInitialized(rootIsolateToken);
_sendPort.send(const _Command(_Codes.ack, arg0: null));
break;
case _Codes.add:
_doAddEntry(command.arg0 as String);
break;
case _Codes.query:
_doFind(command.arg0 as String);
break;
default:
debugPrint(
'_SimpleDatabaseServer unrecognized command ${command.code}');
Expand Down
2 changes: 1 addition & 1 deletion background_isolate_channels/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: '>=2.19.5 <4.0.0'
sdk: ^3.0.0-0

dependencies:
cupertino_icons: ^1.0.2
Expand Down
4 changes: 2 additions & 2 deletions code_sharing/client/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ class _MyHomePageState extends State<MyHomePage> {
),
if (isWriting) ...[
const SizedBox(height: 10),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
children: <Widget>[
Text(
'Communicating with server...',
style: TextStyle(fontSize: 32, color: Colors.blue),
Expand Down
2 changes: 1 addition & 1 deletion code_sharing/client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ publish_to: "none"
version: 1.0.0+1

environment:
sdk: '>=2.19.5 <4.0.0'
sdk: ^3.0.0-0

dependencies:
cupertino_icons: ^1.0.2
Expand Down
2 changes: 1 addition & 1 deletion code_sharing/server/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: "none"

environment:
sdk: '>=2.19.5 <4.0.0'
sdk: ^3.0.0-0

dependencies:
args: ^2.0.0
Expand Down
2 changes: 1 addition & 1 deletion code_sharing/shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Common data models required by our client and server
version: 1.0.0

environment:
sdk: '>=2.19.5 <4.0.0'
sdk: ^3.0.0-0

dependencies:
freezed_annotation: ^2.1.0
Expand Down
10 changes: 7 additions & 3 deletions deeplink_store_example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ class MyApp extends StatelessWidget {
debugShowCheckedModeBanner: false,
routerConfig: GoRouter(
routes: [
GoRoute(path: '/', builder: (_, __) => const ProductList(),
GoRoute(
path: '/',
builder: (_, __) => const ProductList(),
routes: [
GoRoute(path: ':id', builder: (_, __) => const ProductDetails()),
],
),
GoRoute(path: '/category/:category', builder: (_, __) => const ProductCategoryList()),
GoRoute(
path: '/category/:category',
builder: (_, __) => const ProductCategoryList()),
],
),
);
}
}
}
18 changes: 6 additions & 12 deletions deeplink_store_example/lib/model/products_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,12 @@ class ProductsRepository {
}
}

String getCategoryTitle(Category category) {
switch(category) {
case Category.all:
return 'All';
case Category.accessories:
return 'Accessories';
case Category.clothing:
return 'Clothing';
case Category.home:
return 'Home Decorations';
}
}
String getCategoryTitle(Category category) => switch (category) {
Category.all => 'All',
Category.accessories => 'Accessories',
Category.clothing => 'Clothing',
Category.home => 'Home Decorations'
};

class Product {
const Product({
Expand Down
13 changes: 8 additions & 5 deletions deeplink_store_example/lib/product_category_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ class ProductCategoryList extends StatelessWidget {
Widget build(BuildContext context) {
final GoRouterState state = GoRouterState.of(context);
final Category category = Category.values.firstWhere(
(Category value) => value.toString().contains(state.params['category']!),
(Category value) =>
value.toString().contains(state.pathParameters['category']!),
orElse: () => Category.all,
);
final List<Widget> children = ProductsRepository.loadProducts(category: category)
.map<Widget>((Product p) => RowItem(product: p))
.toList();
final List<Widget> children =
ProductsRepository.loadProducts(category: category)
.map<Widget>((Product p) => RowItem(product: p))
.toList();
return Scaffold(
backgroundColor: Styles.scaffoldBackground,
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
title: Text(getCategoryTitle(category), style: Styles.productListTitle),
title: Text(getCategoryTitle(category),
style: Styles.productListTitle),
backgroundColor: Styles.scaffoldAppBarBackground,
pinned: true,
),
Expand Down
9 changes: 5 additions & 4 deletions deeplink_store_example/lib/product_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ class ProductDetails extends StatelessWidget {

@override
Widget build(BuildContext context) {
final String currentId = GoRouterState.of(context).params['id']!;
final Product product = ProductsRepository.loadProduct(id: int.parse(currentId));
final String currentId = GoRouterState.of(context).pathParameters['id']!;
final Product product =
ProductsRepository.loadProduct(id: int.parse(currentId));
return Scaffold(
body: ListView(
children: <Widget>[
Expand All @@ -40,7 +41,7 @@ class ProductDetails extends StatelessWidget {
}
}

class ProductPicture extends StatelessWidget{
class ProductPicture extends StatelessWidget {
const ProductPicture({super.key, required this.product});

final Product product;
Expand All @@ -63,4 +64,4 @@ class ProductPicture extends StatelessWidget{
],
);
}
}
}
4 changes: 2 additions & 2 deletions deeplink_store_example/lib/product_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class ProductList extends StatelessWidget {
@override
Widget build(BuildContext context) {
final List<Widget> children = ProductsRepository.loadProducts()
.map<Widget>((Product p) => RowItem(product: p))
.toList();
.map<Widget>((Product p) => RowItem(product: p))
.toList();
return Scaffold(
backgroundColor: Styles.scaffoldBackground,
body: CustomScrollView(
Expand Down
4 changes: 2 additions & 2 deletions deeplink_store_example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: '>=3.0.0-290.0.dev <4.0.0'
sdk: ^3.0.0-0

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand All @@ -36,7 +36,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
shrine_images: ^2.0.2
go_router: ^6.5.5
go_router: ^7.0.0

dev_dependencies:
flutter_test:
Expand Down
Loading

0 comments on commit 36e7a6a

Please sign in to comment.