Remove unneeded types (#949)

pull/951/head
Ahmed Ashour 3 years ago committed by GitHub
parent 64805fe5b6
commit 29339b8334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,7 +18,7 @@ class Book {
Thumbnail? thumbnail; Thumbnail? thumbnail;
Object encode() { Object encode() {
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{}; final pigeonMap = <Object?, Object?>{};
pigeonMap['title'] = title; pigeonMap['title'] = title;
pigeonMap['subtitle'] = subtitle; pigeonMap['subtitle'] = subtitle;
pigeonMap['author'] = author; pigeonMap['author'] = author;
@ -30,7 +30,7 @@ class Book {
} }
static Book decode(Object message) { static Book decode(Object message) {
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>; final pigeonMap = message as Map<Object?, Object?>;
return Book() return Book()
..title = pigeonMap['title'] as String? ..title = pigeonMap['title'] as String?
..subtitle = pigeonMap['subtitle'] as String? ..subtitle = pigeonMap['subtitle'] as String?
@ -48,13 +48,13 @@ class Thumbnail {
String? url; String? url;
Object encode() { Object encode() {
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{}; final pigeonMap = <Object?, Object?>{};
pigeonMap['url'] = url; pigeonMap['url'] = url;
return pigeonMap; return pigeonMap;
} }
static Thumbnail decode(Object message) { static Thumbnail decode(Object message) {
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>; final pigeonMap = message as Map<Object?, Object?>;
return Thumbnail()..url = pigeonMap['url'] as String?; return Thumbnail()..url = pigeonMap['url'] as String?;
} }
} }
@ -89,7 +89,7 @@ abstract class FlutterBookApi {
void displayBookDetails(Book book); void displayBookDetails(Book book);
static void setup(FlutterBookApi? api) { static void setup(FlutterBookApi? api) {
{ {
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( const channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.FlutterBookApi.displayBookDetails', codec); 'dev.flutter.pigeon.FlutterBookApi.displayBookDetails', codec);
if (api == null) { if (api == null) {
channel.setMessageHandler(null); channel.setMessageHandler(null);
@ -146,7 +146,7 @@ class HostBookApi {
static const MessageCodec<Object?> codec = _HostBookApiCodec(); static const MessageCodec<Object?> codec = _HostBookApiCodec();
Future<void> cancel() async { Future<void> cancel() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( final channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostBookApi.cancel', codec, 'dev.flutter.pigeon.HostBookApi.cancel', codec,
binaryMessenger: _binaryMessenger); binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = final Map<Object?, Object?>? replyMap =
@ -158,8 +158,7 @@ class HostBookApi {
details: null, details: null,
); );
} else if (replyMap['error'] != null) { } else if (replyMap['error'] != null) {
final Map<Object?, Object?> error = final error = (replyMap['error'] as Map<Object?, Object?>?)!;
(replyMap['error'] as Map<Object?, Object?>?)!;
throw PlatformException( throw PlatformException(
code: (error['code'] as String?)!, code: (error['code'] as String?)!,
message: error['message'] as String?, message: error['message'] as String?,

@ -73,7 +73,7 @@ class _MyHomePageState extends State<MyHomePage> {
body: Center( body: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: [
const Text( const Text(
'You have pushed the button this many times:', 'You have pushed the button this many times:',
), ),

@ -59,7 +59,7 @@ class _MyHomePageState extends State<MyHomePage> {
return Scaffold( return Scaffold(
body: Center( body: Center(
child: Column( child: Column(
children: <Widget>[ children: [
const Padding( const Padding(
padding: EdgeInsets.only(top: 42, bottom: 250), padding: EdgeInsets.only(top: 42, bottom: 250),
child: Align( child: Align(

@ -53,7 +53,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
body: Center( body: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: [
FadeTransition( FadeTransition(
opacity: _animation, opacity: _animation,
child: const Icon( child: const Icon(

@ -78,7 +78,7 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('AnimatedList'), title: const Text('AnimatedList'),
actions: <Widget>[ actions: [
IconButton( IconButton(
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
onPressed: addUser, onPressed: addUser,

@ -42,11 +42,11 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Center( child: Center(
child: Column( child: Column(
children: <Widget>[ children: [
Expanded( Expanded(
child: ClipRect( child: ClipRect(
child: Stack( child: Stack(
children: <Widget>[ children: [
for (final fileName in fileNames) for (final fileName in fileNames)
SwipeableCard( SwipeableCard(
imageAssetName: fileName, imageAssetName: fileName,

@ -115,7 +115,7 @@ class UnsplashHomePage extends StatelessWidget {
onPhotoSave: (photo) async { onPhotoSave: (photo) async {
final path = await getSavePath( final path = await getSavePath(
suggestedName: '${photo.id}.jpg', suggestedName: '${photo.id}.jpg',
acceptedTypeGroups: <XTypeGroup>[ acceptedTypeGroups: [
XTypeGroup( XTypeGroup(
label: 'JPG', label: 'JPG',
extensions: ['jpg'], extensions: ['jpg'],

@ -42,7 +42,7 @@ class PolicyDialog extends StatelessWidget {
text: TextSpan( text: TextSpan(
text: '', text: '',
style: const TextStyle(color: Colors.black, fontSize: 18), style: const TextStyle(color: Colors.black, fontSize: 18),
children: <TextSpan>[ children: [
TextSpan( TextSpan(
text: 'https://policies.google.com/terms', text: 'https://policies.google.com/terms',
style: const TextStyle( style: const TextStyle(
@ -64,7 +64,7 @@ class PolicyDialog extends StatelessWidget {
text: TextSpan( text: TextSpan(
text: '', text: '',
style: const TextStyle(color: Colors.black, fontSize: 18), style: const TextStyle(color: Colors.black, fontSize: 18),
children: <TextSpan>[ children: [
TextSpan( TextSpan(
text: 'https://unsplash.com/terms', text: 'https://unsplash.com/terms',
style: const TextStyle( style: const TextStyle(
@ -86,7 +86,7 @@ class PolicyDialog extends StatelessWidget {
); );
}, },
), ),
actions: <Widget>[ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();

@ -49,7 +49,7 @@ class _PhotoSearchDialogState extends State<PhotoSearchDialog> {
} }
}, },
), ),
actions: <Widget>[ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();

@ -17,7 +17,7 @@ class NewCategoryDialog extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const SimpleDialog( return const SimpleDialog(
title: Text('New Category'), title: Text('New Category'),
children: <Widget>[ children: [
NewCategoryForm(), NewCategoryForm(),
], ],
); );

@ -27,7 +27,7 @@ class _NewEntryFormState extends State<NewEntryForm> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: CategoryDropdown( child: CategoryDropdown(

@ -65,7 +65,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
hintText: '(123) 456-7890', hintText: '(123) 456-7890',
labelText: 'Telephone', labelText: 'Telephone',
), ),
autofillHints: <String>[AutofillHints.telephoneNumber], autofillHints: [AutofillHints.telephoneNumber],
), ),
const TextField( const TextField(
keyboardType: TextInputType.streetAddress, keyboardType: TextInputType.streetAddress,
@ -74,7 +74,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
hintText: '123 4th Ave', hintText: '123 4th Ave',
labelText: 'Street Address', labelText: 'Street Address',
), ),
autofillHints: <String>[AutofillHints.streetAddressLine1], autofillHints: [AutofillHints.streetAddressLine1],
), ),
const TextField( const TextField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@ -83,7 +83,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
hintText: '12345', hintText: '12345',
labelText: 'Postal Code', labelText: 'Postal Code',
), ),
autofillHints: <String>[AutofillHints.postalCode], autofillHints: [AutofillHints.postalCode],
), ),
const TextField( const TextField(
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
@ -91,7 +91,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
hintText: 'United States', hintText: 'United States',
labelText: 'Country', labelText: 'Country',
), ),
autofillHints: <String>[AutofillHints.countryName], autofillHints: [AutofillHints.countryName],
), ),
const TextField( const TextField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@ -99,7 +99,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
hintText: '1', hintText: '1',
labelText: 'Country Code', labelText: 'Country Code',
), ),
autofillHints: <String>[AutofillHints.countryCode], autofillHints: [AutofillHints.countryCode],
), ),
].expand( ].expand(
(widget) => [ (widget) => [

@ -43,7 +43,7 @@ class _DemoState extends State<Demo> {
child: Center( child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: [
Text(deviceInfo), Text(deviceInfo),
const Padding(padding: EdgeInsets.only(top: 18)), const Padding(padding: EdgeInsets.only(top: 18)),
const FlutterLogo(size: 128), const FlutterLogo(size: 128),

@ -11,7 +11,7 @@ import 'package:jsonexample/dart_convert/converted_simple_object.dart';
import 'package:jsonexample/json_serializable/serializable_simple_object.dart'; import 'package:jsonexample/json_serializable/serializable_simple_object.dart';
void main() { void main() {
const typicalObjectJson = <String, dynamic>{ const typicalObjectJson = {
'aString': 'Blah, blah, blah.', 'aString': 'Blah, blah, blah.',
'anInt': 1, 'anInt': 1,
'aDouble': 1.0, 'aDouble': 1.0,
@ -20,7 +20,7 @@ void main() {
'aListOfDoubles': [1.0, 2.0, 3.0] 'aListOfDoubles': [1.0, 2.0, 3.0]
}; };
const emptyListJson = <String, dynamic>{ const emptyListJson = {
'aString': 'Blah, blah, blah.', 'aString': 'Blah, blah, blah.',
'anInt': 1, 'anInt': 1,
'aDouble': 1.0, 'aDouble': 1.0,
@ -29,7 +29,7 @@ void main() {
'aListOfDoubles': <double>[] 'aListOfDoubles': <double>[]
}; };
const unexpectedPropertiesJson = <String, dynamic>{ const unexpectedPropertiesJson = {
'aString': 'Blah, blah, blah.', 'aString': 'Blah, blah, blah.',
'anInt': 1, 'anInt': 1,
'aDouble': 1.0, 'aDouble': 1.0,

@ -145,7 +145,7 @@ class StubData {
), ),
]; ];
static const reviewStrings = <String>[ static const reviewStrings = [
'My favorite place in Portland. The employees are wonderful and so is the food. I go here at least once a month!', 'My favorite place in Portland. The employees are wonderful and so is the food. I go here at least once a month!',
'Staff was very friendly. Great atmosphere and good music. Would recommend.', 'Staff was very friendly. Great atmosphere and good music. Would recommend.',
'Best. Place. In. Town. Period.' 'Best. Place. In. Town. Period.'

@ -25,7 +25,7 @@ class _AddPetDetailsState extends State<AddPetDetails> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Add Pet Details'), title: const Text('Add Pet Details'),
actions: <Widget>[ actions: [
IconButton( IconButton(
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
onPressed: () { onPressed: () {

@ -63,7 +63,7 @@ class MyHomePage extends StatelessWidget {
body: Center( body: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: [
const Text('You have pushed the button this many times:'), const Text('You have pushed the button this many times:'),
// Consumer looks for an ancestor Provider widget // Consumer looks for an ancestor Provider widget
// and retrieves its model (Counter, in this case). // and retrieves its model (Counter, in this case).

@ -17,7 +17,7 @@ class HomePage extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Testing Sample'), title: const Text('Testing Sample'),
actions: <Widget>[ actions: [
TextButton.icon( TextButton.icon(
style: TextButton.styleFrom(primary: Colors.white), style: TextButton.styleFrom(primary: Colors.white),
onPressed: () { onPressed: () {

@ -174,7 +174,7 @@ class InfoView extends StatelessWidget {
children: [ children: [
Row( Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: [
FutureBuilder<Set<VeggieCategory>>( FutureBuilder<Set<VeggieCategory>>(
future: prefs.preferredCategories, future: prefs.preferredCategories,
builder: (context, snapshot) { builder: (context, snapshot) {

@ -233,7 +233,7 @@ class SettingsScreen extends StatelessWidget {
content: const Text( content: const Text(
'Are you sure you want to reset the current settings?', 'Are you sure you want to reset the current settings?',
), ),
actions: <Widget>[ actions: [
CupertinoDialogAction( CupertinoDialogAction(
isDestructiveAction: true, isDestructiveAction: true,
child: const Text('Yes'), child: const Text('Yes'),
@ -266,7 +266,7 @@ class SettingsScreen extends StatelessWidget {
Styles.scaffoldBackground(CupertinoTheme.brightnessOf(context)), Styles.scaffoldBackground(CupertinoTheme.brightnessOf(context)),
child: CustomScrollView( child: CustomScrollView(
restorationId: 'list', restorationId: 'list',
slivers: <Widget>[ slivers: [
const CupertinoSliverNavigationBar( const CupertinoSliverNavigationBar(
largeTitle: Text('Settings'), largeTitle: Text('Settings'),
), ),
@ -274,7 +274,7 @@ class SettingsScreen extends StatelessWidget {
top: false, top: false,
sliver: SliverList( sliver: SliverList(
delegate: SliverChildListDelegate( delegate: SliverChildListDelegate(
<Widget>[ [
SettingsGroup( SettingsGroup(
items: [ items: [
_buildCaloriesItem(context, prefs), _buildCaloriesItem(context, prefs),

@ -130,7 +130,7 @@ class SettingsItemState extends State<SettingsItem> {
child: widget.subtitle != null child: widget.subtitle != null
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: [
const SizedBox(height: 8.5), const SizedBox(height: 8.5),
Text(widget.label, Text(widget.label,
style: themeData.textTheme.textStyle), style: themeData.textTheme.textStyle),

@ -122,7 +122,7 @@ class VeggieCard extends StatelessWidget {
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: [
Text( Text(
veggie.name, veggie.name,
style: Styles.cardTitleText(themeData), style: Styles.cardTitleText(themeData),

@ -153,7 +153,7 @@ class DisjointMeasureAxisLineChart extends StatelessWidget {
primaryMeasureAxis: const charts.NumericAxisSpec( primaryMeasureAxis: const charts.NumericAxisSpec(
tickProviderSpec: charts.StaticNumericTickProviderSpec( tickProviderSpec: charts.StaticNumericTickProviderSpec(
// Create the ticks to be used the domain axis. // Create the ticks to be used the domain axis.
<charts.TickSpec<num>>[ [
charts.TickSpec(0, label: ''), charts.TickSpec(0, label: ''),
charts.TickSpec(1, label: ''), charts.TickSpec(1, label: ''),
charts.TickSpec(2, label: ''), charts.TickSpec(2, label: ''),

@ -81,7 +81,7 @@ class StaticallyProvidedTicks extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// Create the ticks to be used the domain axis. // Create the ticks to be used the domain axis.
final staticTicks = <charts.TickSpec<String>>[ final staticTicks = [
const charts.TickSpec( const charts.TickSpec(
// Value must match the domain value. // Value must match the domain value.
'2014', '2014',

@ -29,7 +29,7 @@ class GalleryDrawer extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Drawer( return Drawer(
child: ListView(children: <Widget>[ child: ListView(children: [
// Performance overlay toggle. // Performance overlay toggle.
ListTile( ListTile(
leading: const Icon(Icons.assessment), leading: const Icon(Icons.assessment),

@ -57,7 +57,7 @@ class _GalleryScaffoldState extends State<GalleryScaffold> {
appBar: AppBar(title: Text(widget.title)), appBar: AppBar(title: Text(widget.title)),
body: Padding( body: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column(children: <Widget>[ child: Column(children: [
SizedBox(height: 250.0, child: widget.childBuilder()), SizedBox(height: 250.0, child: widget.childBuilder()),
])), ])),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(

@ -60,7 +60,7 @@ class CatmullInterpolator implements Interpolator {
} }
static void test() { static void test() {
List<Point2D> controlPoints = <Point2D>[]; final controlPoints = <Point2D>[];
controlPoints.add(Point2D(-1, 1)); controlPoints.add(Point2D(-1, 1));
controlPoints.add(Point2D(0, 1)); controlPoints.add(Point2D(0, 1));
controlPoints.add(Point2D(1, -1)); controlPoints.add(Point2D(1, -1));

@ -49,9 +49,9 @@ class LayeredChartState extends State<LayeredChart> {
graphHeight = MathUtils.clampedMap(screenRatio, 0.5, 2.5, 50, 150); graphHeight = MathUtils.clampedMap(screenRatio, 0.5, 2.5, 50, 150);
int m = dataToPlot.length; int m = dataToPlot.length;
paths = <Path>[]; paths = [];
capPaths = <Path>[]; capPaths = [];
maxValues = <double>[]; maxValues = [];
for (int i = 0; i < m; i++) { for (int i = 0; i < m; i++) {
int n = dataToPlot[i].series.length; int n = dataToPlot[i].series.length;
maxValues.add(0); maxValues.add(0);
@ -71,11 +71,11 @@ class LayeredChartState extends State<LayeredChart> {
double xWidth = (endX - startX) / numPoints; double xWidth = (endX - startX) / numPoints;
double capRangeX = capSize * cos(capTheta); double capRangeX = capSize * cos(capTheta);
double tanCapTheta = tan(capTheta); double tanCapTheta = tan(capTheta);
List<double> curvePoints = <double>[]; final curvePoints = <double>[];
for (int i = 0; i < m; i++) { for (int i = 0; i < m; i++) {
List<int> series = dataToPlot[i].series; List<int> series = dataToPlot[i].series;
int n = series.length; int n = series.length;
List<Point2D> controlPoints = <Point2D>[]; final controlPoints = <Point2D>[];
controlPoints.add(Point2D(-1, 0)); controlPoints.add(Point2D(-1, 0));
double last = 0; double last = 0;
for (int j = 0; j < n; j++) { for (int j = 0; j < n; j++) {
@ -135,7 +135,7 @@ class LayeredChartState extends State<LayeredChart> {
capPaths[i].lineTo(startX, startY + 1); capPaths[i].lineTo(startX, startY + 1);
capPaths[i].close(); capPaths[i].close();
} }
labelPainter = <TextPainter>[]; labelPainter = [];
for (int i = 0; i < dataToPlot.length; i++) { for (int i = 0; i < dataToPlot.length; i++) {
TextSpan span = TextSpan( TextSpan span = TextSpan(
style: const TextStyle( style: const TextStyle(
@ -148,7 +148,7 @@ class LayeredChartState extends State<LayeredChart> {
tp.layout(); tp.layout();
labelPainter.add(tp); labelPainter.add(tp);
} }
milestonePainter = <TextPainter>[]; milestonePainter = [];
for (int i = 0; i < milestones.length; i++) { for (int i = 0; i < milestones.length; i++) {
TextSpan span = TextSpan( TextSpan span = TextSpan(
style: const TextStyle( style: const TextStyle(

@ -48,7 +48,7 @@ class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
createAnimation(0); createAnimation(0);
weekLabels = <WeekLabel>[]; weekLabels = [];
weekLabels.add(WeekLabel.forDate(DateTime(2019, 2, 26), 'v1.2')); weekLabels.add(WeekLabel.forDate(DateTime(2019, 2, 26), 'v1.2'));
weekLabels.add(WeekLabel.forDate(DateTime(2018, 12, 4), 'v1.0')); weekLabels.add(WeekLabel.forDate(DateTime(2018, 12, 4), 'v1.0'));
// weekLabels.add(WeekLabel.forDate(new DateTime(2018, 9, 19), "Preview 2")); // weekLabels.add(WeekLabel.forDate(new DateTime(2018, 9, 19), "Preview 2"));
@ -155,7 +155,7 @@ class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
Column mainColumn = Column( Column mainColumn = Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: [
Expanded(child: layeredChart), Expanded(child: layeredChart),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(

@ -20,7 +20,7 @@ class ParticleBackgroundPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Stack(
children: <Widget>[ children: [
Positioned.fill(child: AnimatedBackground()), Positioned.fill(child: AnimatedBackground()),
Positioned.fill(child: Particles(30)), Positioned.fill(child: Particles(30)),
Positioned.fill(child: CenteredText()), Positioned.fill(child: CenteredText()),

Loading…
Cancel
Save