Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-10-23 18:07:18 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cd828017be8a18d541bc3f6d18d4dc40a8f9e9e3
cd828017
1 parent
1f5c02d5
move Address to its own file
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
19 deletions
CHANGELOG.md
lib/mobile_scanner.dart
lib/src/objects/address.dart
lib/src/objects/barcode.dart
lib/src/objects/contact_info.dart
CHANGELOG.md
View file @
cd82801
## NEXT
Improvements:
*
The
`type` of an `Address`
is now non-null.
*
The
`type` of an `Email`
is now non-null.
*
The
`phoneNumber` of an `SMS`
is now non-null.
*
The
`latitude` and `longitude` of a `GeoPoint`
are now non-null.
...
...
lib/mobile_scanner.dart
View file @
cd82801
...
...
@@ -12,6 +12,7 @@ export 'src/enums/torch_state.dart';
export
'src/mobile_scanner.dart'
;
export
'src/mobile_scanner_controller.dart'
;
export
'src/mobile_scanner_exception.dart'
;
export
'src/objects/address.dart'
;
export
'src/objects/barcode.dart'
;
export
'src/objects/barcode_capture.dart'
;
export
'src/objects/calendar_event.dart'
;
...
...
lib/src/objects/address.dart
0 → 100644
View file @
cd82801
import
'package:mobile_scanner/src/enums/address_type.dart'
;
/// An address.
class
Address
{
/// Creates a new [Address] instance.
const
Address
({
this
.
addressLines
=
const
<
String
>[],
this
.
type
=
AddressType
.
unknown
,
});
/// Creates a new [Address] instance from a map.
factory
Address
.
fromNative
(
Map
<
Object
?,
Object
?>
data
)
{
final
List
<
Object
?>?
addressLines
=
data
[
'addressLines'
]
as
List
<
Object
?>?;
final
AddressType
type
=
AddressType
.
fromRawValue
(
data
[
'type'
]
as
int
?
??
0
,
);
if
(
addressLines
==
null
)
{
return
Address
(
type:
type
);
}
return
Address
(
addressLines:
List
.
unmodifiable
(
addressLines
.
cast
<
String
>()),
type:
type
,
);
}
/// The address lines that represent this address.
final
List
<
String
>
addressLines
;
/// Gets type of the address.
final
AddressType
type
;
}
...
...
lib/src/objects/barcode.dart
View file @
cd82801
...
...
@@ -2,7 +2,6 @@ import 'dart:typed_data';
import
'dart:ui'
;
import
'package:mobile_scanner/src/barcode_utility.dart'
;
import
'package:mobile_scanner/src/enums/address_type.dart'
;
import
'package:mobile_scanner/src/enums/barcode_format.dart'
;
import
'package:mobile_scanner/src/enums/barcode_type.dart'
;
import
'package:mobile_scanner/src/enums/phone_type.dart'
;
...
...
@@ -123,24 +122,6 @@ class Barcode {
wifi
=
toWiFi
(
data
[
'wifi'
]
as
Map
?);
}
/// An address.
class
Address
{
/// Gets formatted address, multiple lines when appropriate. This field always contains at least one line.
final
List
<
String
>
addressLines
;
/// Gets type of the address.
///
/// Returns null if not available.
final
AddressType
?
type
;
/// Create a [Address] from native data.
Address
.
fromNative
(
Map
data
)
:
addressLines
=
List
.
unmodifiable
(
(
data
[
'addressLines'
]
as
List
?
??
[]).
cast
<
String
>(),
),
type
=
AddressType
.
values
[
data
[
'type'
]
as
int
];
}
/// Phone number info.
class
Phone
{
/// Gets phone number.
...
...
lib/src/objects/contact_info.dart
View file @
cd82801
import
'package:mobile_scanner/src/objects/address.dart'
;
import
'package:mobile_scanner/src/objects/barcode.dart'
;
import
'package:mobile_scanner/src/objects/email.dart'
;
import
'package:mobile_scanner/src/objects/person_name.dart'
;
...
...
Please
register
or
login
to post a comment