upgrade min sdk; run formatter
This commit is contained in:
@@ -21,13 +21,12 @@ class MyAppState extends State<MyApp> {
|
||||
title: const Text('Native Fragment Example'),
|
||||
actions: [
|
||||
MenuAnchor(
|
||||
builder:
|
||||
(context, controller, child) => IconButton(
|
||||
onPressed: () {
|
||||
controller.open();
|
||||
},
|
||||
icon: const Icon(Icons.menu),
|
||||
),
|
||||
builder: (context, controller, child) => IconButton(
|
||||
onPressed: () {
|
||||
controller.open();
|
||||
},
|
||||
icon: const Icon(Icons.menu),
|
||||
),
|
||||
menuChildren: [
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
|
||||
@@ -5,7 +5,7 @@ description: "Demonstrates how to use the flutter_mozilla_components plugin."
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
environment:
|
||||
sdk: '>=3.7.0 <4.0.0'
|
||||
sdk: '>=3.8.0 <4.0.0'
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
||||
@@ -42,13 +42,12 @@ abstract class Source {
|
||||
String? packageId,
|
||||
int? packageCategory,
|
||||
) {
|
||||
final caller =
|
||||
packageId != null
|
||||
? ExternalPackage(
|
||||
packageId: packageId,
|
||||
category: PackageCategory.fromInt(packageCategory).toValue(),
|
||||
)
|
||||
: null;
|
||||
final caller = packageId != null
|
||||
? ExternalPackage(
|
||||
packageId: packageId,
|
||||
category: PackageCategory.fromInt(packageCategory).toValue(),
|
||||
)
|
||||
: null;
|
||||
|
||||
switch (sourceId) {
|
||||
case 1:
|
||||
|
||||
+11
-12
@@ -25,18 +25,17 @@ class GeckoBrowserExtensionService extends BrowserExtensionEvents {
|
||||
.getMarkdown(htmlList)
|
||||
.timeout(timeout);
|
||||
|
||||
final results =
|
||||
markdownResult
|
||||
.cast()
|
||||
.map(
|
||||
(result) => TurndownResults(
|
||||
// ignore: avoid_dynamic_calls valid
|
||||
markdown: result['fullContentMarkdown'] as String,
|
||||
// ignore: avoid_dynamic_calls valid
|
||||
plain: result['fullContentPlain'] as String,
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
final results = markdownResult
|
||||
.cast()
|
||||
.map(
|
||||
(result) => TurndownResults(
|
||||
// ignore: avoid_dynamic_calls valid
|
||||
markdown: result['fullContentMarkdown'] as String,
|
||||
// ignore: avoid_dynamic_calls valid
|
||||
plain: result['fullContentPlain'] as String,
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -12,17 +12,16 @@ class GeckoPrefService {
|
||||
}
|
||||
|
||||
Future<Map<String, Object>> applyPrefs(Map<String, Object> prefs) {
|
||||
final buffer =
|
||||
prefs.entries.map((pref) {
|
||||
final value = switch (pref.value) {
|
||||
final bool x => '$x',
|
||||
final int x => '$x',
|
||||
final String x => '"$x"',
|
||||
_ => throw Exception('Unknow pref type'),
|
||||
};
|
||||
final buffer = prefs.entries.map((pref) {
|
||||
final value = switch (pref.value) {
|
||||
final bool x => '$x',
|
||||
final int x => '$x',
|
||||
final String x => '"$x"',
|
||||
_ => throw Exception('Unknow pref type'),
|
||||
};
|
||||
|
||||
return 'user_pref("${pref.key}", $value);';
|
||||
}).join();
|
||||
return 'user_pref("${pref.key}", $value);';
|
||||
}).join();
|
||||
|
||||
return _apiInstance.applyPrefs(buffer);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ version: 0.0.1
|
||||
homepage:
|
||||
|
||||
environment:
|
||||
sdk: '>=3.7.0 <4.0.0'
|
||||
sdk: '>=3.8.0 <4.0.0'
|
||||
flutter: '>=3.3.0'
|
||||
|
||||
dependencies:
|
||||
|
||||
@@ -5,7 +5,7 @@ description: "Demonstrates how to use the simple_intent_receiver plugin."
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.2
|
||||
sdk: ^3.8.0
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
|
||||
@@ -8,7 +8,11 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
|
||||
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) {
|
||||
List<Object?> wrapResponse({
|
||||
Object? result,
|
||||
PlatformException? error,
|
||||
bool empty = false,
|
||||
}) {
|
||||
if (empty) {
|
||||
return <Object?>[];
|
||||
}
|
||||
@@ -17,21 +21,25 @@ List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty
|
||||
}
|
||||
return <Object?>[error.code, error.message, error.details];
|
||||
}
|
||||
|
||||
bool _deepEquals(Object? a, Object? b) {
|
||||
if (a is List && b is List) {
|
||||
return a.length == b.length &&
|
||||
a.indexed
|
||||
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]));
|
||||
a.indexed.every(
|
||||
((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]),
|
||||
);
|
||||
}
|
||||
if (a is Map && b is Map) {
|
||||
return a.length == b.length && a.entries.every((MapEntry<Object?, Object?> entry) =>
|
||||
(b as Map<Object?, Object?>).containsKey(entry.key) &&
|
||||
_deepEquals(entry.value, b[entry.key]));
|
||||
return a.length == b.length &&
|
||||
a.entries.every(
|
||||
(MapEntry<Object?, Object?> entry) =>
|
||||
(b as Map<Object?, Object?>).containsKey(entry.key) &&
|
||||
_deepEquals(entry.value, b[entry.key]),
|
||||
);
|
||||
}
|
||||
return a == b;
|
||||
}
|
||||
|
||||
|
||||
class Intent {
|
||||
Intent({
|
||||
this.fromPackageName,
|
||||
@@ -52,17 +60,12 @@ class Intent {
|
||||
Map<String, Object?> extra;
|
||||
|
||||
List<Object?> _toList() {
|
||||
return <Object?>[
|
||||
fromPackageName,
|
||||
action,
|
||||
data,
|
||||
categories,
|
||||
extra,
|
||||
];
|
||||
return <Object?>[fromPackageName, action, data, categories, extra];
|
||||
}
|
||||
|
||||
Object encode() {
|
||||
return _toList(); }
|
||||
return _toList();
|
||||
}
|
||||
|
||||
static Intent decode(Object result) {
|
||||
result as List<Object?>;
|
||||
@@ -89,11 +92,9 @@ class Intent {
|
||||
|
||||
@override
|
||||
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
||||
int get hashCode => Object.hashAll(_toList())
|
||||
;
|
||||
int get hashCode => Object.hashAll(_toList());
|
||||
}
|
||||
|
||||
|
||||
class _PigeonCodec extends StandardMessageCodec {
|
||||
const _PigeonCodec();
|
||||
@override
|
||||
@@ -101,7 +102,7 @@ class _PigeonCodec extends StandardMessageCodec {
|
||||
if (value is int) {
|
||||
buffer.putUint8(4);
|
||||
buffer.putInt64(value);
|
||||
} else if (value is Intent) {
|
||||
} else if (value is Intent) {
|
||||
buffer.putUint8(129);
|
||||
writeValue(buffer, value.encode());
|
||||
} else {
|
||||
@@ -112,7 +113,7 @@ class _PigeonCodec extends StandardMessageCodec {
|
||||
@override
|
||||
Object? readValueOfType(int type, ReadBuffer buffer) {
|
||||
switch (type) {
|
||||
case 129:
|
||||
case 129:
|
||||
return Intent.decode(readValue(buffer)!);
|
||||
default:
|
||||
return super.readValueOfType(type, buffer);
|
||||
@@ -125,32 +126,49 @@ abstract class IntentEvents {
|
||||
|
||||
void onIntentReceived(int timestamp, Intent intent);
|
||||
|
||||
static void setUp(IntentEvents? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) {
|
||||
messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
|
||||
static void setUp(
|
||||
IntentEvents? api, {
|
||||
BinaryMessenger? binaryMessenger,
|
||||
String messageChannelSuffix = '',
|
||||
}) {
|
||||
messageChannelSuffix = messageChannelSuffix.isNotEmpty
|
||||
? '.$messageChannelSuffix'
|
||||
: '';
|
||||
{
|
||||
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived$messageChannelSuffix', pigeonChannelCodec,
|
||||
binaryMessenger: binaryMessenger);
|
||||
final BasicMessageChannel<Object?>
|
||||
pigeonVar_channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived$messageChannelSuffix',
|
||||
pigeonChannelCodec,
|
||||
binaryMessenger: binaryMessenger,
|
||||
);
|
||||
if (api == null) {
|
||||
pigeonVar_channel.setMessageHandler(null);
|
||||
} else {
|
||||
pigeonVar_channel.setMessageHandler((Object? message) async {
|
||||
assert(message != null,
|
||||
'Argument for dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived was null.');
|
||||
assert(
|
||||
message != null,
|
||||
'Argument for dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived was null.',
|
||||
);
|
||||
final List<Object?> args = (message as List<Object?>?)!;
|
||||
final int? arg_timestamp = (args[0] as int?);
|
||||
assert(arg_timestamp != null,
|
||||
'Argument for dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived was null, expected non-null int.');
|
||||
assert(
|
||||
arg_timestamp != null,
|
||||
'Argument for dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived was null, expected non-null int.',
|
||||
);
|
||||
final Intent? arg_intent = (args[1] as Intent?);
|
||||
assert(arg_intent != null,
|
||||
'Argument for dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived was null, expected non-null Intent.');
|
||||
assert(
|
||||
arg_intent != null,
|
||||
'Argument for dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived was null, expected non-null Intent.',
|
||||
);
|
||||
try {
|
||||
api.onIntentReceived(arg_timestamp!, arg_intent!);
|
||||
return wrapResponse(empty: true);
|
||||
} on PlatformException catch (e) {
|
||||
return wrapResponse(error: e);
|
||||
} catch (e) {
|
||||
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
|
||||
} catch (e) {
|
||||
return wrapResponse(
|
||||
error: PlatformException(code: 'error', message: e.toString()),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ version: 0.0.1
|
||||
homepage:
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.2
|
||||
sdk: ^3.8.0
|
||||
flutter: '>=3.3.0'
|
||||
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user