Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions lib/commune.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'langs.dart';
import 'postCode.dart';

class Commune {
Map<String, dynamic> data;
Map<String, dynamic>? data;
Commune({this.data});

/**
Expand All @@ -14,7 +14,7 @@ class Commune {
*/
List<PostCode> getPostCodes() {
return algeria_postcodes
.where((element) => ((element['commune_name'] == data['commune_name'])))
.where((element) => element['commune_name'] == data!['commune_name'])
.map((e) => PostCode(data: e))
.toSet()
.toList();
Expand All @@ -26,14 +26,14 @@ class Commune {
* this method take [language] (FR or AR) as parameter
* and return wilaya name of the commune
*/
String getWilayaName(Language lang) {
String? getWilayaName(Language lang) {
if (lang == Language.AR) {
return data['wilaya_name'];
return data!['wilaya_name'];
} else if (lang == Language.FR) {
return data['wilaya_name_ascii'];
return data!['wilaya_name_ascii'];
//for additional languages
} else
return data['wilaya_name_ascii'];
return data!['wilaya_name_ascii'];
}

/**
Expand All @@ -42,14 +42,14 @@ class Commune {
* this method take [language] (FR or AR) as parameter
* and return daira name of the commune
*/
String getDairaName(Language lang) {
String? getDairaName(Language lang) {
if (lang == Language.AR) {
return data['daira_name'];
return data!['daira_name'];
} else if (lang == Language.FR) {
return data['daira_name_ascii'];
return data!['daira_name_ascii'];
//for additional languages
} else
return data['daira_name_ascii'];
return data!['daira_name_ascii'];
}

/**
Expand All @@ -58,22 +58,22 @@ class Commune {
* this method take [language] (FR or AR) as parameter
* and return the name of the commune
*/
String getCommuneName(Language lang) {
String? getCommuneName(Language lang) {
if (lang == Language.AR) {
return data['commune_name'];
return data!['commune_name'];
} else if (lang == Language.FR) {
return data['commune_name_ascii'];
return data!['commune_name_ascii'];
//for additional languages
} else
return data['commune_name_ascii'];
return data!['commune_name_ascii'];
}

/**
* Returns [String] object
*
* this method return the code number of the wilaya
*/
String getWilayaCode() {
return data['wilaya_code'];
String? getWilayaCode() {
return data!['wilaya_code'];
}
}
34 changes: 17 additions & 17 deletions lib/daira.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'langs.dart';
import 'postCode.dart';

class Daira {
Map<String, dynamic> data;
Map<String, dynamic>? data;
Daira({this.data});

/**
Expand All @@ -16,7 +16,7 @@ class Daira {
*/
List<Commune> getCommunes() {
return algeria_cites
.where((element) => (element['daira_name'] == data['daira_name']))
.where((element) => (element['daira_name'] == data!['daira_name']))
.map((e) => Commune(data: e))
.toSet()
.toList();
Expand All @@ -30,7 +30,7 @@ class Daira {
*/
List<PostCode> getPostCodes() {
return algeria_postcodes
.where((element) => ((element['daira_name'] == data['daira_name'])))
.where((element) => element['daira_name'] == data!['daira_name'])
.map((e) => PostCode(data: e))
.toSet()
.toList();
Expand All @@ -42,14 +42,14 @@ class Daira {
* this method take [language] (FR or AR) as parameter
* and return wilaya name of the daira
*/
String getWilayaName(Language lang) {
String? getWilayaName(Language lang) {
if (lang == Language.AR) {
return data['wilaya_name'];
return data!['wilaya_name'];
} else if (lang == Language.FR) {
return data['wilaya_name _ascii'];
return data!['wilaya_name _ascii'];
//for additional languages
} else
return data['wilaya_name_ascii'];
return data!['wilaya_name_ascii'];
}

/**
Expand All @@ -58,14 +58,14 @@ class Daira {
* this method take [language] (FR or AR) as parameter
* and return the name of the daira
*/
String getDairaName(Language lang) {
String? getDairaName(Language lang) {
if (lang == Language.AR) {
return data['daira_name'];
return data!['daira_name'];
} else if (lang == Language.FR) {
return data['daira_name_ascii'];
return data!['daira_name_ascii'];
//for additional languages
} else
return data['daira_name_ascii'];
return data!['daira_name_ascii'];
}

/**
Expand All @@ -74,22 +74,22 @@ class Daira {
* this method take [language] (FR or AR) as parameter
* and return commune name of the daira
*/
String getCommuneName(Language lang) {
String? getCommuneName(Language lang) {
if (lang == Language.AR) {
return data['commune_name'];
return data!['commune_name'];
} else if (lang == Language.FR) {
return data['commune_name_ascii'];
return data!['commune_name_ascii'];
//for additional languages
} else
return data['commune_name_ascii'];
return data!['commune_name_ascii'];
}

/**
* Returns [String] object
*
* this method return the code number of the wilaya
*/
String getWilayaCode() {
return data['wilaya_code'];
String? getWilayaCode() {
return data!['wilaya_code'];
}
}
16 changes: 8 additions & 8 deletions lib/postCode.dart
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
class PostCode {
Map<String, String> data;
late Map<String, String> data;
PostCode({data});

/**
* return [String] object
* this method returns the post code
*/
String getPostCode() {
String? getPostCode() {
return data['post_code'];
}

/**
* return [String] object
* this method returns the code name
*/
String getPostName() {
String? getPostName() {
return data['post_name'];
}

/**
* return [String] object
* this method returns the code address
*/
String getPostAddress() {
String? getPostAddress() {
return data['post_address'];
}

/**
* return [String] object
* this method returns the commune name
*/
String getCommuneName() {
String? getCommuneName() {
return data['commune_name'];
}

/**
* return [String] object
* this method returns the daira name
*/
String getDairaName() {
String? getDairaName() {
return data['diara_name'];
}

/**
* return [String] object
* this method returns the wilaya name
*/
String getWilayaName() {
String? getWilayaName() {
return data['wilaya_name'];
}

/**
* return [String] object
* this method returns the wilaya code
*/
String getWilayaCode() {
String? getWilayaCode() {
return data['wilaya_code'];
}
}
34 changes: 17 additions & 17 deletions lib/wilaya.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'postCode.dart';
import 'data/algeria_cites.dart';

class Wilaya {
Map<String, dynamic> data;
Map<String, dynamic>? data;
Wilaya({this.data});

/**
Expand All @@ -18,7 +18,7 @@ class Wilaya {
List<Daira> getDairas() {
return algeria_cites
.where((element) =>
(element['wilaya_name_ascii'] == data['wilaya_name_ascii']) &&
(element['wilaya_name_ascii'] == data!['wilaya_name_ascii']) &&
(element['daira_name'] == element['commune_name']))
.map((e) => Daira(data: e))
.toSet()
Expand All @@ -34,7 +34,7 @@ class Wilaya {
List<Commune> getCommunes() {
return algeria_cites
.where((element) =>
(element['wilaya_name_ascii'] == data['wilaya_name_ascii']))
(element['wilaya_name_ascii'] == data!['wilaya_name_ascii']))
.map((e) => Commune(data: e))
.toSet()
.toList();
Expand All @@ -48,9 +48,9 @@ class Wilaya {
*/
List<PostCode> getPostCodes() {
return algeria_postcodes
.where((element) => ((element['wilaya_name'] == data['wilaya_name']) &&
(element['wilaya_name'] == data['daira_name']) &&
(element['wilaya_name'] == data['commune_name'])))
.where((element) => ((element['wilaya_name'] == data!['wilaya_name']) &&
(element['wilaya_name'] == data!['daira_name']) &&
(element['wilaya_name'] == data!['commune_name'])))
.map((e) => PostCode(data: e))
.toSet()
.toList();
Expand All @@ -67,11 +67,11 @@ class Wilaya {
return algeria_cites
.where((element) {
if (language == Language.AR) {
return (((element['wilaya_name'] == data['wilaya_name'])) &&
return (element['wilaya_name'] == data!['wilaya_name'] &&
(element['daira_name'] == element['commune_name']) &&
(element['daira_name'].toString().contains(diaraName)));
} else {
return ((element['wilaya_name'] == data['wilaya_name']) &&
return ((element['wilaya_name'] == data!['wilaya_name']) &&
(element['daira_name'] == element['commune_name']) &&
(element['daira_name_ascii'].toString().contains(diaraName)));
}
Expand All @@ -92,10 +92,10 @@ class Wilaya {
return algeria_cites
.where((element) {
if (language == Language.AR) {
return ((element['wilaya_name'] == data['wilaya_name']) &&
return ((element['wilaya_name'] == data!['wilaya_name']) &&
(element['commune_name'].toString().contains(communeName)));
} else {
return ((element['wilaya_name'] == data['wilaya_name']) &&
return ((element['wilaya_name'] == data!['wilaya_name']) &&
(element['commune_name_ascii']
.toString()
.contains(communeName)));
Expand All @@ -112,25 +112,25 @@ class Wilaya {
* this method take [language] (FR or AR) as parameter
* and return the name of the wilaya
*/
String getWilayaName(Language lang) {
String? getWilayaName(Language lang) {
if (lang == Language.AR) {
return data['wilaya_name'];
return data!['wilaya_name'];
} else if (lang == Language.FR) {
if (data.containsKey('wilaya_name_ascii')) {
return data['wilaya_name_ascii'];
if (data!.containsKey('wilaya_name_ascii')) {
return data!['wilaya_name_ascii'];
}
return "not available";
//for additional languages
} else
return data['wilaya_name_ascii'];
return data!['wilaya_name_ascii'];
}

/**
* Returns [String] object
*
* this method return the code number of the wilaya
*/
String getWilayaCode() {
return data['wilaya_code'];
String? getWilayaCode() {
return data!['wilaya_code'];
}
}
Loading