install codemetric; apply changes for check-unnecessary-nullable
This commit is contained in:
parent
2b0a0428a0
commit
d927ccea39
|
@ -6,7 +6,7 @@ part 'g1_wallets_list.g.dart';
|
|||
@HiveType(typeId: 2)
|
||||
class G1WalletsList {
|
||||
@HiveField(0)
|
||||
String? pubkey;
|
||||
late String address;
|
||||
|
||||
@HiveField(1)
|
||||
double? balance;
|
||||
|
@ -27,7 +27,7 @@ class G1WalletsList {
|
|||
bool? isMembre;
|
||||
|
||||
G1WalletsList({
|
||||
this.pubkey,
|
||||
required this.address,
|
||||
this.balance,
|
||||
this.id,
|
||||
this.avatar,
|
||||
|
@ -37,14 +37,14 @@ class G1WalletsList {
|
|||
});
|
||||
|
||||
G1WalletsList.fromJson(Map<String, dynamic> json) {
|
||||
pubkey = json['pubkey'];
|
||||
address = json['pubkey'];
|
||||
balance = json['balance'];
|
||||
id = json['id'] != null ? Id.fromJson(json['id']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['pubkey'] = pubkey;
|
||||
data['pubkey'] = address;
|
||||
data['balance'] = balance;
|
||||
if (id != null) {
|
||||
data['id'] = id!.toJson();
|
||||
|
|
|
@ -17,7 +17,7 @@ class G1WalletsListAdapter extends TypeAdapter<G1WalletsList> {
|
|||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return G1WalletsList(
|
||||
pubkey: fields[0] as String?,
|
||||
address: fields[0] as String,
|
||||
balance: fields[1] as double?,
|
||||
id: fields[2] as Id?,
|
||||
avatar: fields[3] as Image?,
|
||||
|
@ -32,7 +32,7 @@ class G1WalletsListAdapter extends TypeAdapter<G1WalletsList> {
|
|||
writer
|
||||
..writeByte(7)
|
||||
..writeByte(0)
|
||||
..write(obj.pubkey)
|
||||
..write(obj.address)
|
||||
..writeByte(1)
|
||||
..write(obj.balance)
|
||||
..writeByte(2)
|
||||
|
|
|
@ -59,8 +59,10 @@ const keyCloseTransactionScreen = Key('keyCloseTransactionScreen');
|
|||
|
||||
// Activity view
|
||||
const keyListTransactions = Key('keyListTransactions');
|
||||
const keyActivityScreen = Key('keyActivityScreen');
|
||||
|
||||
// Unlock wallet
|
||||
const keyUnlockWallet = Key('keyUnlockWallet');
|
||||
const keyPinForm = Key('keyPinForm');
|
||||
const keyPopButton = Key('keyPopButton');
|
||||
const keyCachePassword = Key('keyCachePassword');
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:path_provider/path_provider.dart';
|
|||
|
||||
class CesiumPlusProvider with ChangeNotifier {
|
||||
TextEditingController cesiumName = TextEditingController();
|
||||
Image defaultAvatar(double? size) =>
|
||||
Image defaultAvatar(double size) =>
|
||||
Image.asset(('assets/icon_user.png'), height: size);
|
||||
|
||||
CancelToken avatarCancelToken = CancelToken();
|
||||
|
|
|
@ -212,7 +212,7 @@ class DuniterIndexer with ChangeNotifier {
|
|||
g1WalletsBox.put(
|
||||
address,
|
||||
G1WalletsList(
|
||||
pubkey: address, username: walletNameIndexer[address]));
|
||||
address: address, username: walletNameIndexer[address]));
|
||||
|
||||
// log.d(g1WalletsBox.toMap().values.first.username);
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class SearchProvider with ChangeNotifier {
|
|||
WalletsProfilesProvider('pubkey');
|
||||
|
||||
if (walletProfiles.isAddress(searchController.text)) {
|
||||
G1WalletsList wallet = G1WalletsList(pubkey: searchController.text);
|
||||
G1WalletsList wallet = G1WalletsList(address: searchController.text);
|
||||
return [wallet];
|
||||
} else {
|
||||
return [];
|
||||
|
|
|
@ -548,7 +548,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<KeyPairData?> changePassword(BuildContext context, String address,
|
||||
String passOld, String? passNew) async {
|
||||
String passOld, String passNew) async {
|
||||
final account = getKeypair(address);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
|
|
@ -19,7 +19,7 @@ import 'package:provider/provider.dart';
|
|||
class WalletsProfilesProvider with ChangeNotifier {
|
||||
WalletsProfilesProvider(this.address);
|
||||
|
||||
String? address = '';
|
||||
String address = '';
|
||||
String pubkeyShort = '';
|
||||
|
||||
bool isHistoryScreen = false;
|
||||
|
@ -231,10 +231,10 @@ class WalletsProfilesProvider with ChangeNotifier {
|
|||
|
||||
Future addContact(G1WalletsList profile) async {
|
||||
// log.d(profile.username);
|
||||
if (isContact(profile.pubkey!)) {
|
||||
await contactsBox.delete(profile.pubkey);
|
||||
if (isContact(profile.address)) {
|
||||
await contactsBox.delete(profile.address);
|
||||
} else {
|
||||
await contactsBox.put(profile.pubkey, profile);
|
||||
await contactsBox.put(profile.address, profile);
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ import 'package:graphql_flutter/graphql_flutter.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
|
||||
class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||
ActivityScreen({required this.address, this.avatar, this.username, Key? key})
|
||||
: super(key: key);
|
||||
ActivityScreen({required this.address, required this.avatar, this.username})
|
||||
: super(key: keyActivityScreen);
|
||||
final ScrollController scrollController = ScrollController();
|
||||
final double avatarsSize = 80;
|
||||
final String? address;
|
||||
final String address;
|
||||
final String? username;
|
||||
final Image? avatar;
|
||||
final Image avatar;
|
||||
|
||||
FetchMore? fetchMore;
|
||||
FetchMoreOptions? opts;
|
||||
|
@ -49,7 +49,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
|||
),
|
||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: Column(children: <Widget>[
|
||||
walletProfile.headerProfileView(context, address!, username),
|
||||
walletProfile.headerProfileView(context, address, username),
|
||||
historyQuery(context),
|
||||
]));
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
|||
|
||||
if (result.isNotLoading) {
|
||||
// log.d(result.data);
|
||||
opts = duniterIndexer.checkQueryResult(result, opts, address!);
|
||||
opts = duniterIndexer.checkQueryResult(result, opts, address);
|
||||
}
|
||||
|
||||
// Build history list
|
||||
|
|
|
@ -187,8 +187,8 @@ class CommonElements {
|
|||
}
|
||||
|
||||
class SmoothTransition extends PageRouteBuilder {
|
||||
final Widget? page;
|
||||
SmoothTransition({this.page})
|
||||
final Widget page;
|
||||
SmoothTransition({required this.page})
|
||||
: super(
|
||||
pageBuilder: (
|
||||
BuildContext context,
|
||||
|
@ -199,7 +199,7 @@ class SmoothTransition extends PageRouteBuilder {
|
|||
duration: const Duration(seconds: 5),
|
||||
tween: Tween(begin: 200, end: 200),
|
||||
builder: (BuildContext context, dynamic value, Widget? child) {
|
||||
return page!;
|
||||
return page;
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
@ -72,7 +72,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
));
|
||||
}
|
||||
|
||||
Widget myWalletsTiles(BuildContext context, int? currentChest) {
|
||||
Widget myWalletsTiles(BuildContext context, int currentChest) {
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
|
|
@ -17,9 +17,8 @@ import 'package:provider/provider.dart';
|
|||
import 'package:gecko/globals.dart';
|
||||
|
||||
class UnlockingWallet extends StatelessWidget {
|
||||
UnlockingWallet({Key? keyUnlockWallet, required this.wallet})
|
||||
: super(key: keyUnlockWallet);
|
||||
WalletData? wallet;
|
||||
UnlockingWallet({required this.wallet}) : super(key: keyUnlockWallet);
|
||||
WalletData wallet;
|
||||
late int currentChestNumber;
|
||||
late ChestData currentChest;
|
||||
bool canUnlock = true;
|
||||
|
@ -39,7 +38,7 @@ class UnlockingWallet extends StatelessWidget {
|
|||
currentChestNumber = configBox.get('currentChest');
|
||||
currentChest = chestBox.get(currentChestNumber)!;
|
||||
|
||||
int pinLenght = walletOptions.getPinLenght(wallet!.number);
|
||||
int pinLenght = walletOptions.getPinLenght(wallet.number);
|
||||
errorController = StreamController<ErrorAnimationType>();
|
||||
|
||||
return Scaffold(
|
||||
|
|
|
@ -77,7 +77,7 @@ class ContactsScreen extends StatelessWidget {
|
|||
leading: cesiumPlusProvider
|
||||
.defaultAvatar(avatarSize),
|
||||
title: Row(children: <Widget>[
|
||||
Text(getShortPubkey(g1Wallet.pubkey!),
|
||||
Text(getShortPubkey(g1Wallet.address),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Monospace',
|
||||
|
@ -98,14 +98,14 @@ class ContactsScreen extends StatelessWidget {
|
|||
MainAxisAlignment.center,
|
||||
children: [
|
||||
balance(context,
|
||||
g1Wallet.pubkey!, 16),
|
||||
g1Wallet.address, 16),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
subtitle: Row(children: <Widget>[
|
||||
duniterIndexer.getNameByAddress(
|
||||
context, g1Wallet.pubkey!)
|
||||
context, g1Wallet.address)
|
||||
]),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
|
@ -114,15 +114,15 @@ class ContactsScreen extends StatelessWidget {
|
|||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfilesClass.address =
|
||||
g1Wallet.pubkey;
|
||||
g1Wallet.address;
|
||||
return WalletViewScreen(
|
||||
address: g1Wallet.pubkey,
|
||||
address: g1Wallet.address,
|
||||
username: g1WalletsBox
|
||||
.get(g1Wallet.pubkey)
|
||||
.get(g1Wallet.address)
|
||||
?.id
|
||||
?.username,
|
||||
avatar: g1WalletsBox
|
||||
.get(g1Wallet.pubkey)
|
||||
.get(g1Wallet.address)
|
||||
?.avatar,
|
||||
);
|
||||
}),
|
||||
|
|
|
@ -94,13 +94,13 @@ class SearchResultScreen extends StatelessWidget {
|
|||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: ListTile(
|
||||
key: keySearchResult(g1Wallet.pubkey!),
|
||||
key: keySearchResult(g1Wallet.address),
|
||||
horizontalTitleGap: 40,
|
||||
contentPadding: const EdgeInsets.all(5),
|
||||
leading: cesiumPlusProvider
|
||||
.defaultAvatar(avatarSize),
|
||||
title: Row(children: <Widget>[
|
||||
Text(getShortPubkey(g1Wallet.pubkey!),
|
||||
Text(getShortPubkey(g1Wallet.address),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Monospace',
|
||||
|
@ -124,7 +124,7 @@ class SearchResultScreen extends StatelessWidget {
|
|||
children: [
|
||||
balance(
|
||||
context,
|
||||
g1Wallet.pubkey!,
|
||||
g1Wallet.address,
|
||||
16),
|
||||
]),
|
||||
]),
|
||||
|
@ -132,7 +132,7 @@ class SearchResultScreen extends StatelessWidget {
|
|||
]),
|
||||
subtitle: Row(children: <Widget>[
|
||||
duniterIndexer.getNameByAddress(
|
||||
context, g1Wallet.pubkey!)
|
||||
context, g1Wallet.address)
|
||||
]),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
|
@ -141,15 +141,15 @@ class SearchResultScreen extends StatelessWidget {
|
|||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfilesClass.address =
|
||||
g1Wallet.pubkey;
|
||||
g1Wallet.address;
|
||||
return WalletViewScreen(
|
||||
address: g1Wallet.pubkey,
|
||||
address: g1Wallet.address,
|
||||
username: g1WalletsBox
|
||||
.get(g1Wallet.pubkey)
|
||||
.get(g1Wallet.address)
|
||||
?.id
|
||||
?.username,
|
||||
avatar: g1WalletsBox
|
||||
.get(g1Wallet.pubkey)
|
||||
.get(g1Wallet.address)
|
||||
?.avatar,
|
||||
);
|
||||
}),
|
||||
|
|
|
@ -35,10 +35,10 @@ class TransactionInProgress extends StatelessWidget {
|
|||
|
||||
// sub.spawnBlock();
|
||||
|
||||
log.d(walletViewProvider.address!);
|
||||
log.d(walletViewProvider.address);
|
||||
|
||||
final from = fromAddress ?? myWalletProvider.getDefaultWallet().name!;
|
||||
final to = toAddress ?? getShortPubkey(walletViewProvider.address!);
|
||||
final to = toAddress ?? getShortPubkey(walletViewProvider.address);
|
||||
final amount = walletViewProvider.payAmount.text;
|
||||
String actionName = '';
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
|
|
|
@ -26,7 +26,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
const WalletViewScreen(
|
||||
{required this.address, this.username, this.avatar, Key? key})
|
||||
: super(key: key);
|
||||
final String? address;
|
||||
final String address;
|
||||
final String? username;
|
||||
final Image? avatar;
|
||||
final double buttonSize = 100;
|
||||
|
@ -39,7 +39,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
CesiumPlusProvider cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||
walletProfile.address = address!;
|
||||
walletProfile.address = address;
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
|
@ -68,10 +68,10 @@ class WalletViewScreen extends StatelessWidget {
|
|||
});
|
||||
// G1WalletsList(pubkey: pubkey!, username: username);
|
||||
await walletProfile.addContact(
|
||||
newContact ?? G1WalletsList(pubkey: address!));
|
||||
newContact ?? G1WalletsList(address: address));
|
||||
},
|
||||
icon: Icon(
|
||||
walletProfile.isContact(address!)
|
||||
walletProfile.isContact(address)
|
||||
? Icons.add_reaction_rounded
|
||||
: Icons.add_reaction_outlined,
|
||||
size: 35,
|
||||
|
@ -85,13 +85,13 @@ class WalletViewScreen extends StatelessWidget {
|
|||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return QrCodeFullscreen(
|
||||
walletProfile.address!,
|
||||
walletProfile.address,
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: QrImageWidget(
|
||||
data: walletProfile.address!,
|
||||
data: walletProfile.address,
|
||||
version: QrVersions.auto,
|
||||
size: 80,
|
||||
),
|
||||
|
@ -107,7 +107,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
walletProfile.headerProfileView(context, address!, username),
|
||||
walletProfile.headerProfileView(context, address, username),
|
||||
SizedBox(height: isTall ? 10 : 0),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||
Column(children: <Widget>[
|
||||
|
@ -150,7 +150,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
return FutureBuilder(
|
||||
future: sub.certState(defaultWallet.address!, address!),
|
||||
future: sub.certState(defaultWallet.address!, address),
|
||||
builder: (context, AsyncSnapshot<Map<String, int>> snapshot) {
|
||||
if (snapshot.data == null) return const SizedBox();
|
||||
String duration = '';
|
||||
|
@ -217,7 +217,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
context,
|
||||
"areYouSureYouWantToCertify".tr(
|
||||
args: [
|
||||
getShortPubkey(address!)
|
||||
getShortPubkey(address)
|
||||
]));
|
||||
|
||||
if (result ?? false) {
|
||||
|
@ -243,10 +243,9 @@ class WalletViewScreen extends StatelessWidget {
|
|||
final acc = sub.getCurrentWallet();
|
||||
sub.certify(
|
||||
acc.address!,
|
||||
walletViewProvider.address!,
|
||||
walletViewProvider.address,
|
||||
pin ??
|
||||
myWalletProvider.pinCode);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
|
@ -334,7 +333,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
splashColor: yellowC,
|
||||
onTap: sub.nodeConnected
|
||||
? () {
|
||||
paymentPopup(context, address!);
|
||||
paymentPopup(context, address);
|
||||
}
|
||||
: null,
|
||||
child: const Padding(
|
||||
|
|
39
pubspec.lock
39
pubspec.lock
|
@ -7,14 +7,28 @@ packages:
|
|||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "47.0.0"
|
||||
version: "46.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.7.0"
|
||||
version: "4.6.0"
|
||||
analyzer_plugin:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer_plugin
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.0"
|
||||
ansicolor:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ansicolor
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -253,6 +267,20 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
csslib:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: csslib
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.17.2"
|
||||
dart_code_metrics:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: dart_code_metrics
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.17.1"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -535,6 +563,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: html
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.15.0"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
|||
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 0.0.11+30
|
||||
version: 0.0.11+31
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
@ -67,6 +67,7 @@ dev_dependencies:
|
|||
sdk: flutter
|
||||
integration_test:
|
||||
sdk: flutter
|
||||
dart_code_metrics: ^4.17.1
|
||||
|
||||
flutter_icons:
|
||||
android: true
|
||||
|
|
Loading…
Reference in New Issue