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

Migrate code to null safety #18

Merged
merged 1 commit into from
Jun 30, 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 example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,5 @@ packages:
source: hosted
version: "2.1.0"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"
43 changes: 21 additions & 22 deletions lib/castle.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

class Castle {
static const MethodChannel _channel =
const MethodChannel('castle');

static Future<void> configure({@required publishableKey, debugLoggingEnabled, maxQueueLimit, flushLimit, useCloudflareApp, baseURLAllowList}) async {
static Future<void> configure({required publishableKey, debugLoggingEnabled, maxQueueLimit, flushLimit, useCloudflareApp, baseURLAllowList}) async {
await _channel.invokeMethod('configure', <String, dynamic>{
'publishableKey': publishableKey,
'debugLoggingEnabled': debugLoggingEnabled,
Expand Down Expand Up @@ -41,8 +40,8 @@ class Castle {
await _channel.invokeMethod('flush');
}

static Future<bool> flushIfNeeded(String url) async {
final bool flushIfNeeded = await _channel.invokeMethod('flushIfNeeded', <String, dynamic>{
static Future<bool?> flushIfNeeded(String url) async {
final bool? flushIfNeeded = await _channel.invokeMethod('flushIfNeeded', <String, dynamic>{
'url': url,
});
return flushIfNeeded;
Expand All @@ -52,48 +51,48 @@ class Castle {
await _channel.invokeMethod('reset');
}

static Future<String> get baseUrl async {
final String baseUrl = await _channel.invokeMethod('baseUrl');
static Future<String?> get baseUrl async {
final String? baseUrl = await _channel.invokeMethod('baseUrl');
return baseUrl;
}

static Future<String> get clientId async {
final String clientId = await _channel.invokeMethod('clientId');
static Future<String?> get clientId async {
final String? clientId = await _channel.invokeMethod('clientId');
return clientId;
}

static Future<String> get clientIdHeaderName async {
final String clientIdHeaderName = await _channel.invokeMethod('clientIdHeaderName');
static Future<String?> get clientIdHeaderName async {
final String? clientIdHeaderName = await _channel.invokeMethod('clientIdHeaderName');
return clientIdHeaderName;
}

static Future<String> get createRequestToken async {
final String token = await _channel.invokeMethod('createRequestToken');
static Future<String?> get createRequestToken async {
final String? token = await _channel.invokeMethod('createRequestToken');
return token;
}

static Future<String> get requestTokenHeaderName async {
final String requestTokenHeaderName = await _channel.invokeMethod('requestTokenHeaderName');
static Future<String?> get requestTokenHeaderName async {
final String? requestTokenHeaderName = await _channel.invokeMethod('requestTokenHeaderName');
return requestTokenHeaderName;
}

static Future<String> get userId async {
final String userId = await _channel.invokeMethod('userId');
static Future<String?> get userId async {
final String? userId = await _channel.invokeMethod('userId');
return userId;
}

static Future<String> get userSignature async {
final String userSignature = await _channel.invokeMethod('userSignature');
static Future<String?> get userSignature async {
final String? userSignature = await _channel.invokeMethod('userSignature');
return userSignature;
}

static Future<String> get userAgent async {
final String userAgent = await _channel.invokeMethod('userAgent');
static Future<String?> get userAgent async {
final String? userAgent = await _channel.invokeMethod('userAgent');
return userAgent;
}

static Future<int> get queueSize async {
final int queueSize = await _channel.invokeMethod('queueSize');
static Future<int?> get queueSize async {
final int? queueSize = await _channel.invokeMethod('queueSize');
return queueSize;
}
}
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,5 @@ packages:
source: hosted
version: "6.1.0+1"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: Castle Intelligence, Inc
homepage: https://github.com/castle/castle-flutter

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

dependencies:
Expand Down