import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:photo/photo.dart'; import 'icon_text_button.dart'; import 'package:photo_manager/photo_manager.dart'; class PickedExample extends StatefulWidget { @override _PickedExampleState createState() => _PickedExampleState(); } class _PickedExampleState extends State { List picked = []; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Cross Picked asset"), ), body: Column( children: [ IconTextButton( icon: Icons.assignment, text: "Pick asset", onTap: _pickAsset, ), ListTile( title: Text("picked asset count = ${picked.length}"), ), ], ), ); } void _pickAsset() async { final entity = await PhotoPicker.pickAsset( context: context, pickedAssetList: picked, ); if (entity != null && entity.asset.isNotEmpty) { picked.clear(); picked.addAll(entity.asset); setState(() {}); } } }