Update Provider to Prevent Null Safety Crashes on Updated Flutter
This commit is contained in:
parent
bf6440dcfd
commit
1ff3b06fb3
|
@ -85,7 +85,7 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
|
||||
Widget _buildContactList() {
|
||||
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
|
||||
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.onion), value: contact, builder: (_, __) => ContactRow());
|
||||
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.profileOnion+""+contact.onion), value: contact, builder: (_, __) => ContactRow());
|
||||
});
|
||||
final divided = ListTile.divideTiles(
|
||||
context: context,
|
||||
|
|
|
@ -140,11 +140,7 @@ class _MessageViewState extends State<MessageView> {
|
|||
),
|
||||
onPressed: _sendMessage,
|
||||
))),
|
||||
SizedBox(
|
||||
width: 86,
|
||||
height: 40,
|
||||
child: IconButton(icon: Icon(Icons.insert_invitation, size: 12, color: Provider.of<Settings>(context).theme.mainTextColor()), onPressed: () => _modalSendInvitation(context))),
|
||||
])
|
||||
])
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -88,15 +88,17 @@ class _ContactRowState extends State<ContactRow> {
|
|||
|
||||
void _pushMessageView(String handle) {
|
||||
Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(handle).unreadMessages = 0;
|
||||
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (BuildContext builderContext) {
|
||||
var profile = Provider.of<FlwtchState>(builderContext, listen: false).profs.getProfile(profileOnion);
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context)),
|
||||
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context).contactList.getContact(handle)),
|
||||
ChangeNotifierProvider.value(value: profile),
|
||||
ChangeNotifierProvider.value(value: profile.contactList.getContact(handle)),
|
||||
],
|
||||
child: MessageView(),
|
||||
builder:(context, child) => MessageView(),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -14,7 +14,7 @@ packages:
|
|||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.6.0"
|
||||
version: "2.6.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
Loading…
Reference in New Issue