1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-24 13:59:22 +00:00

Progressing with null safety migration

This commit is contained in:
Pierre HUBERT 2022-03-10 19:02:06 +01:00
parent 2424fd38d6
commit ab2c5da0da
18 changed files with 51 additions and 52 deletions

View File

@ -9,6 +9,7 @@ import 'package:connectivity_plus_web/connectivity_plus_web.dart';
import 'package:file_picker/_internal/file_picker_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_messaging_web/firebase_messaging_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:package_info_plus_web/package_info_plus_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';
@ -16,8 +17,6 @@ import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart';
import 'package:wakelock_web/wakelock_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
ConnectivityPlusPlugin.registerWith(registrar);

View File

@ -71,7 +71,7 @@ class ConversationsHelper {
/// Update admin status of a user in a conversation
///
/// Throws in case of failure
static Future<void> setAdmin(int convID, int userID, bool admin) async =>
static Future<void> setAdmin(int/*!*/ convID, int/*!*/ userID, bool admin) async =>
await APIRequest.withLogin("conversations/setAdmin")
.addInt("convID", convID)
.addInt("userID", userID)

View File

@ -7,9 +7,9 @@ import 'package:flutter/widgets.dart';
enum AccountImageVisibilityLevels { EVERYONE, COMUNIC_USERS, FRIENDS_ONLY }
class AccountImageSettings {
final bool hasImage;
final String imageURL;
final AccountImageVisibilityLevels visibility;
final bool/*!*/ hasImage;
final String/*!*/ imageURL;
final AccountImageVisibilityLevels/*!*/ visibility;
const AccountImageSettings({
@required this.hasImage,

View File

@ -17,7 +17,7 @@ class AdvancedGroupInfo extends Group implements LikeElement {
int likes;
bool userLike;
List<Conversation> conversations;
bool isForezGroup;
bool/*!*/ isForezGroup;
AdvancedGroupInfo({
@required int id,

View File

@ -11,15 +11,15 @@ import 'package:meta/meta.dart';
class AdvancedUserInfo extends User implements LikeElement {
final String emailAddress;
final String publicNote;
final bool canPostTexts;
final bool isFriendsListPublic;
final int numberFriends;
final int accountCreationTime;
final String personalWebsite;
final String/*!*/ publicNote;
final bool/*!*/ canPostTexts;
final bool/*!*/ isFriendsListPublic;
final int/*!*/ numberFriends;
final int/*!*/ accountCreationTime;
final String/*!*/ personalWebsite;
final String location;
bool userLike;
int likes;
bool/*!*/ userLike;
int/*!*/ likes;
AdvancedUserInfo({
@required int id,

View File

@ -25,8 +25,8 @@ class BytesFile {
}
class APIRequest {
final String uri;
final bool needLogin;
final String/*!*/ uri;
final bool/*!*/ needLogin;
ProgressCallback progressCallback;
CancelToken cancelToken;
Map<String, String> args;

View File

@ -5,7 +5,7 @@ import 'dart:convert';
/// @author Pierre HUBERT
class APIResponse {
final int code;
final int/*!*/ code;
final String content;
const APIResponse(this.code, this.content) : assert(code != null);

View File

@ -5,9 +5,9 @@ import 'package:flutter/cupertino.dart';
/// @author Pierre Hubert
class ApplicationPreferences {
bool enableDarkMode;
bool forceMobileMode;
bool showPerformancesOverlay;
bool/*!*/ enableDarkMode;
bool/*!*/ forceMobileMode;
bool/*!*/ showPerformancesOverlay;
ApplicationPreferences({
@required this.enableDarkMode,

View File

@ -5,8 +5,8 @@ import 'package:meta/meta.dart';
/// @author Pierre HUBERT
class AuthenticationDetails {
final String email;
final String password;
final String/*!*/ email;
final String/*!*/ password;
const AuthenticationDetails({@required this.email, @required this.password})
: assert(email != null),

View File

@ -6,7 +6,7 @@ import 'package:meta/meta.dart';
/// @author Pierre HUBERT
abstract class CacheModel {
final int id;
final int/*!*/ id;
const CacheModel({@required this.id}) : assert(id != null);

View File

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
/// @author Pierre Hubert
class CallConfig {
final List<String> iceServers;
final List<String>/*!*/ iceServers;
const CallConfig({
@required this.iceServers,

View File

@ -8,8 +8,8 @@ import 'package:flutter_webrtc/flutter_webrtc.dart';
enum MemberStatus { JOINED, READY }
class CallMember {
final int userID;
MemberStatus status;
final int/*!*/ userID;
MemberStatus/*!*/ status;
MediaStream stream;
CallMember({

View File

@ -11,14 +11,14 @@ import 'package:meta/meta.dart';
/// @author Pierre HUBERT
class Comment implements LikeElement {
final int id;
final int userID;
final int postID;
final int timeSent;
DisplayedString content;
final int/*!*/ id;
final int/*!*/ userID;
final int/*!*/ postID;
final int/*!*/ timeSent;
DisplayedString/*!*/ content;
final String imageURL;
int likes;
bool userLike;
int/*!*/ likes;
bool/*!*/ userLike;
Comment({
@required this.id,

View File

@ -55,7 +55,7 @@ class Config {
assert(appName != null);
/// Get and set static configuration
static Config _config;
static Config/*?*/ _config;
static Config get() {
return _config;
@ -67,6 +67,6 @@ class Config {
}
/// Get the current configuration of the application
Config config() {
Config/*!*/ config() {
return Config.get();
}

View File

@ -25,15 +25,15 @@ class Conversation extends SerializableElement<Conversation> {
final bool isHavingCall;
Conversation({
@required this.id,
@required this.lastActivity,
/*required*/ @required this.id,
/*required*/ @required this.lastActivity,
@required this.name,
@required this.color,
@required this.logoURL,
@required this.groupID,
@required this.groupMinMembershipLevel,
@required this.members,
@required this.canEveryoneAddMembers,
/*required*/ @required this.members,
/*required*/ @required this.canEveryoneAddMembers,
this.callCapabilities = CallCapabilities.NONE,
this.isHavingCall = false,
}) : assert(id != null),

View File

@ -5,18 +5,18 @@ import 'package:flutter/widgets.dart';
/// @author Pierre Hubert
class ConversationMember {
final int userID;
final int lastMessageSeen;
final int lastAccessTime;
final bool following;
final bool isAdmin;
final int/*!*/ userID;
final int/*!*/ lastMessageSeen;
final int/*!*/ lastAccessTime;
final bool/*!*/ following;
final bool/*!*/ isAdmin;
const ConversationMember({
@required this.userID,
@required this.lastMessageSeen,
@required this.lastAccessTime,
@required this.following,
@required this.isAdmin,
/*required*/ @required this.userID,
/*required*/ @required this.lastMessageSeen,
/*required*/ @required this.lastAccessTime,
/*required*/ @required this.following,
/*required*/ @required this.isAdmin,
}) : assert(userID != null),
assert(lastMessageSeen != null),
assert(lastAccessTime != null),

View File

@ -14,7 +14,7 @@ enum GroupMembershipLevel {
VISITOR
}
String membershipToText(GroupMembershipLevel level) {
String/*!*/ membershipToText(GroupMembershipLevel level) {
switch (level) {
case GroupMembershipLevel.ADMINISTRATOR:
return tr("Administrator");

View File

@ -50,7 +50,7 @@ String tr(String string, {Map<String, String> args}) {
}
/// Get current lang, in format aa_BB
String get lang => _currLang != null ? _currLang : "en_US";
String/*!*/ get lang => _currLang != null ? _currLang : "en_US";
/// Get short lang format, in format aa