Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to null safety #11

Merged
merged 5 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- uses: subosito/flutter-action@v1.4.0
with:
flutter-version: 1.22.4
flutter-version: 2.0.5
channel: "stable"

- name: Install Dependencies
Expand Down
8 changes: 4 additions & 4 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class _MyAppState extends State<MyApp> {
var platform =
Theme.of(context).platform.toString().split('.')[1].toLowerCase();
try {
bool featureEnabled = await optimizelyPlugin.isFeatureEnabled(
bool? featureEnabled = await optimizelyPlugin.isFeatureEnabled(
'price_filter',
'user@example.org',
{'platform': platform},
Expand Down Expand Up @@ -79,7 +79,7 @@ class _MyAppState extends State<MyApp> {
'user@example.org',
{'platform': platform},
);
int minPrice = variables['min_price'];
int? minPrice = variables['min_price'];
minPriceVariable = "min_price variable is: ${minPrice.toString()}.";
} catch (e) {
minPriceVariable = "Failed to get min_price variable from feature: '$e'.";
Expand All @@ -106,7 +106,7 @@ class _MyAppState extends State<MyApp> {
Center(
child: Text(_priceFilterFlag),
),
RaisedButton(
ElevatedButton(
child: Text('Get Price Filter Flag'),
onPressed: () {
getPriceFilterFlag();
Expand All @@ -116,7 +116,7 @@ class _MyAppState extends State<MyApp> {
Center(
child: Text(_minPriceVariable),
),
RaisedButton(
ElevatedButton(
child: Text('Get Price Filter Min Price'),
onPressed: () {
getPriceFilterMinPrice();
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Demonstrates how to use the optimizely_plugin plugin.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
Expand All @@ -22,7 +22,7 @@ dependencies:

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
cupertino_icons: ^1.0.2

dev_dependencies:
flutter_test:
Expand Down
5 changes: 2 additions & 3 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:optimizely_plugin_example/main.dart';

void main() {
Expand All @@ -18,8 +17,8 @@ void main() {
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
(Widget widget) =>
widget is Text && widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/optimizely_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class OptimizelyPlugin {
});
}

Future<bool> isFeatureEnabled(
Future<bool?> isFeatureEnabled(
String featureKey,
userID,
Map<String, dynamic> attributes,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: optimizely_plugin
description: Flutter plugin for Optimizely SDK
version: 0.1.2
version: 0.1.3
homepage: https://www.policygenius.com/
repository: https://github.com/policygenius/optimizely-plugin

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0 <2.0.0"

dependencies:
Expand Down