-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[shared_preferences] Migrate platform plugins to null-safety #3523
Changes from all commits
2e22820
235cef0
e19321f
e2e33ec
1119226
dad45b8
798a9b6
6cf839c
c4acbf3
827e55f
286637c
92577c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.0.4-nullsafety | ||
|
||
* Migrate to null-safety. | ||
|
||
## 0.0.3+1 | ||
|
||
* Update Flutter SDK constraint. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.2.0-nullsafety | ||
|
||
* Migrate to null-safety. | ||
|
||
## 0.1.2+8 | ||
|
||
* Update Flutter SDK constraint. | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,12 +2,12 @@ | |||||||||||
// Use of this source code is governed by a BSD-style license that can be | ||||||||||||
// found in the LICENSE file. | ||||||||||||
|
||||||||||||
@TestOn('chrome') // Uses web-only Flutter SDK | ||||||||||||
|
||||||||||||
@TestOn('chrome') | ||||||||||||
import 'dart:convert' show json; | ||||||||||||
import 'dart:html' as html; | ||||||||||||
|
||||||||||||
import 'package:flutter_test/flutter_test.dart'; | ||||||||||||
import 'package:shared_preferences_platform_interface/method_channel_shared_preferences.dart'; | ||||||||||||
import 'package:shared_preferences_platform_interface/shared_preferences_platform_interface.dart'; | ||||||||||||
import 'package:shared_preferences_web/shared_preferences_web.dart'; | ||||||||||||
|
||||||||||||
|
@@ -26,6 +26,8 @@ void main() { | |||||||||||
}); | ||||||||||||
|
||||||||||||
test('registers itself', () { | ||||||||||||
SharedPreferencesStorePlatform.instance = | ||||||||||||
MethodChannelSharedPreferencesStore(); | ||||||||||||
expect(SharedPreferencesStorePlatform.instance, | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed this line because it was making the test fail and by reading plugins/packages/shared_preferences/shared_preferences_web/lib/shared_preferences_web.dart Lines 17 to 19 in 2e22820
Maybe I am missing something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ditman ^^^ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at this again: yes, it always registers itself as a What exactly was the error? Does this just need handling of a null instnace? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, as per here : Lines 38 to 39 in 2e22820
It is supposed to return a
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Odd. How about instead of just removing that line, replacing it with manually setting the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is testing that the instance is null until (Maybe with null safety that part of the test is not required anymore?) We'll eventually have to revisit these tests so they run with flutter drive instead of flutter run --platform chrome. Thanks for the migration!! |
||||||||||||
isNot(isA<SharedPreferencesPlugin>())); | ||||||||||||
SharedPreferencesPlugin.registerWith(null); | ||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.